Skip to content

R crashes performing gstat IDW with omax argument

3 messages · Mark Wynter, Tim Appelhans, Edzer Pebesma

#
I'm trying to use gstat's IDW function with an omax argument
Addition of the omax argument causes R to crash - works fine without it.

*** Error in `/usr/lib/R/bin/exec/R': corrupted double-linked list:
0x00000000038c8540 ***
I'm running R v 3.1 on Ubuntu 12.04

Can anyone else replicate this error on R 3.1 with the following script?

#Crashtest
#Libraries
library(sp)
library(gstat)
library(RColorBrewer)

#make some random xyz point data
x = round(runif(100), 2)
y = round(runif(100), 2)
z = data.frame(rainfall=round(runif(100), 2)*1000)

#convert to spatial points data frame
xy = cbind(x, y)
xy.sp = SpatialPoints(xy)
xy.spdf = SpatialPointsDataFrame(xy.sp, z)

#prepare grid surface
x.range <- range(xy.spdf at coords[,1])
y.range <- range(xy.spdf at coords[,2])
grd <- expand.grid(x=seq(from=x.range[1]-0.5, to=x.range[2]+0.5, by=0.01),
y=seq(from=y.range[1]-0.5, to=y.range[2]+0.5, by=0.01) )
coordinates(grd) <- ~ x+y
gridded(grd) <- TRUE

#perform IDW interpolation and plot results
precip.pal <- colorRampPalette(brewer.pal(7, name="Blues"))
precip.idw3 <- idw(rainfall~1, xy.spdf, grd, idp = 3, maxdist=0.2, omax=2)
spplot(precip.idw3, "var1.pred", col.regions=precip.pal, pretty=TRUE,
main="Rainfall Interpolated (mm)", labels=TRUE,
      sp.layout=list("sp.points", xy.spdf, col="red", first=FALSE))

Sent from my iPhone
#
Hey Mark,
I'm running R 3.1.2. on Ubuntu 12.04 and see the following with your 
example:

*** glibc detected *** /usr/lib/R/bin/exec/R: free(): invalid next size 
(fast): 0x00000000073acab0 ***

So nearly, though not exactly the same....

I have no idea what it means though, sorry

Tim
On 11/24/2014 05:19 AM, Mark Wynter wrote:

  
    
#
Thanks for the reproducible and small example!

I found the bug and committed a fix to r-forge.

For the the version that causes this problem, you can use omax when in
addition you specify nmax to the same value (but pls check that the
output makes sense).
On 11/24/2014 09:20 AM, Tim Appelhans wrote: