mathias kuhnt
2013-Jun-08 13:38 UTC
[R] segfault -- address 0x29, cause 'memory not mapped'
Dear List, after a night of calculating, R says goodbye with a segmentation fault. *** caught segfault *** address 0x29, cause 'memory not mapped' In my functions I subsequently read in network files of about 20KB using the IGraph package. Admittedly, I read in about 1 million files, in total 20GB. Still, the function saves the data to the same object and memory of the prior file should be freed. The crash occurs after some hours but not at the same time, last time after having read in 99% of the files. It probably depends on what I did before I started the function. Can anybody tell me if these are limitations of the program and I have to live with it or am I doing something wrong? Is it a general R problem or rather one of the IGraph package? Thanks in advance, Mathias here the code: ##################################################### library(igraph) modnumber<-1200 its<-1000 seriespath<-"/daten/netgen_series/series_m1q2/" mylim<-200 max<-100 startval<-1 sampledegcorr <- function (model, its, max) # I suppose it does not matter what I do here but as you see I read in 1000 network files and analyze them { dc<-rep(NA,max) for (i in 0:(its-1)) { net<-read.graph(paste(seriespath,model,"/",i,".net", sep ""),format="pajek") net<-simplify(net) ndeg <- sapply(V(net),function(x) mean(degree(net,neighbors(net,x))-1)) bo<-stats.bin(degree(net),ndeg,breaks=seq(-0.5,max ,1)) dc<-cbind(dc,bo$stats[2,]) } dck<-as.vector(apply(dc,1,mean, na.rm=T)) return(cbind(seq(0,max-1,1),dck)) } dc<-seq(0,max-1,1) for (i in startval:(modnumber)) # here i start the function above with 1200 different networks { print(paste("calculating model ", i, sep="")) dc<-cbind(dc,sampledegcorr(paste("m", i, sep=""),its,mylim)[,2]) save(dc,file="series_m1q2_dc_results.RData") } ###################################################### here my specs: R 3.0.1-3precise R crashed with SIGSEGV in Rf_StringTrue() Ubuntu 12.04.1 4 GB RAM
On 08.06.2013 15:38, mathias kuhnt wrote:> Dear List, > > after a night of calculating, R says goodbye with a segmentation fault. > > *** caught segfault *** > address 0x29, cause 'memory not mapped' > > In my functions I subsequently read in network files of about 20KB using > the IGraph package. Admittedly, I read in about 1 million files, in > total 20GB. Still, the function saves the data to the same object and > memory of the prior file should be freed. > > The crash occurs after some hours but not at the same time, last time > after having read in 99% of the files. It probably depends on what I did > before I started the function. > > Can anybody tell me if these are limitations of the program and I have > to live with it or am I doing something wrong? Is it a general R problem > or rather one of the IGraph package?I guess igraph, butz cannot be sure without a reproducible example. Perhaps the best idea is to find an example that generates the problem rather quickly and send it to the igraph maintainer. Best, Uwe Ligges> > Thanks in advance, > Mathias > > > here the code: > ##################################################### > library(igraph) > > modnumber<-1200 > its<-1000 > seriespath<-"/daten/netgen_series/series_m1q2/" > mylim<-200 > max<-100 > startval<-1 > > > sampledegcorr <- function (model, its, max) > # I suppose it does not matter what I do here but as you see I read in > 1000 network files and analyze them > { > dc<-rep(NA,max) > for (i in 0:(its-1)) > { > net<-read.graph(paste(seriespath,model,"/",i,".net", sep > ""),format="pajek") > net<-simplify(net) > ndeg <- sapply(V(net),function(x) > mean(degree(net,neighbors(net,x))-1)) > bo<-stats.bin(degree(net),ndeg,breaks=seq(-0.5,max ,1)) > dc<-cbind(dc,bo$stats[2,]) > } > dck<-as.vector(apply(dc,1,mean, na.rm=T)) > return(cbind(seq(0,max-1,1),dck)) > } > > > dc<-seq(0,max-1,1) > for (i in startval:(modnumber)) > # here i start the function above with 1200 different networks > { > print(paste("calculating model ", i, sep="")) > dc<-cbind(dc,sampledegcorr(paste("m", i, sep=""),its,mylim)[,2]) > save(dc,file="series_m1q2_dc_results.RData") > } > ###################################################### > > here my specs: > > R 3.0.1-3precise > R crashed with SIGSEGV in Rf_StringTrue() > Ubuntu 12.04.1 > 4 GB RAM > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >