From brian at braverock.com  Sun Oct  3 11:25:25 2010
From: brian at braverock.com (Brian G. Peterson)
Date: Sun, 03 Oct 2010 04:25:25 -0500
Subject: [Rd] strange interaction between rasterImage and Grid graphics
In-Reply-To: <AANLkTikY-erfsxifHcKyPcnrCnwaiTn5K3s9KTvcfht4@mail.gmail.com>
References: <AANLkTimX=5B478CCrEjCX0Y0Kw-FVuu=6ED5kYQ0iykY@mail.gmail.com>
	<4CA7C1D8.7050202@auckland.ac.nz>
	<AANLkTikY-erfsxifHcKyPcnrCnwaiTn5K3s9KTvcfht4@mail.gmail.com>
Message-ID: <58dc2267d949738dc9a098ff54e26482@braverock.com>

On Sat, 2 Oct 2010 22:36:07 -0700, Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
>> On Sat, Oct 2, 2010 at 4:35 PM, Paul Murrell <p.murrell at auckland.ac.nz>
>> wrote:
>>> The only device I've tried is quartz(), x11() crashed with
rasterImage,
>>
>> That is more serious. ?I have heard of a couple of others like this and
>> I think the common thread may be 64-bit MacOS X. ?
>> I need to get access to such a beast to take a look.
> 
> Or maybe just 64 bit. I have (running Debian unstable)
> 
>> sessionInfo()
> R version 2.12.0 Under development (unstable) (2010-09-02 r52864)
> Platform: x86_64-unknown-linux-gnu (64-bit)
> 
> and I get reproducible crashes (same 'memory not mapped' segfault) with
> 
> x11(type="Xlib")
> example(rasterImage) #or
> 
> library(lattice)
> example(panel.levelplot.raster)
> 
> [I noticed this a while back, but neglected to report.]
> 
> -Deepayan
> 
>>
>> Paul
>>
>>> ?*** caught segfault ***
>>> address 0x28, cause 'memory not mapped'
>>>
>>> Traceback:
>>> ?1: rasterImage(matrix(1), 1, 1, 1, 1)
>>>
>>> sessionInfo()
>>> R version 2.11.1 (2010-05-31)
>>> x86_64-apple-darwin9.8.0

I can confirm the problem exists in 2.11.1 as well on 64 bit Ubuntu:

R version 2.11.1 (2010-05-31)

> x11(type="Xlib")
> example(rasterImage) 

rstrIm> require(grDevices)

rstrIm> ## set up the plot region:
rstrIm> op <- par(bg = "thistle")

rstrIm> plot(c(100, 250), c(300, 450), type = "n", xlab="", ylab="")
Hit <Return> to see next plot: 

rstrIm> image <- as.raster(matrix(0:1, ncol=5, nrow=3))

rstrIm> rasterImage(image, 100, 300, 150, 350, interpolate=FALSE)

 *** caught segfault ***
address 0x28, cause 'memory not mapped'

Traceback:
 1: rasterImage(image, 100, 300, 150, 350, interpolate = FALSE)
 2: eval.with.vis(expr, envir, enclos)
 3: eval.with.vis(ei, envir)
 4: source(tf, local, echo = echo, prompt.echo = paste(prompt.prefix,    
getOption("prompt"), sep = ""), continue.echo = paste(prompt.prefix,    
getOption("continue"), sep = ""), verbose = verbose, max.deparse.length =
Inf,     encoding = encoding, skip.echo = skips, keep.source = TRUE)
 5: example(rasterImage)

The lattice example in Deepyan's email 

library(lattice)
example(panel.levelplot.raster)

works for me in 2.11.1 

Regards,

   - Brian

> sessionInfo()
R version 2.11.1 (2010-05-31) 
x86_64-pc-linux-gnu 

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] lattice_0.19-11

loaded via a namespace (and not attached):
[1] tools_2.11.1



[Rd] strange interaction between rasterImage and Grid graphics
Brian G. Peterson