Dear List, I am trying to?plot?bathymetry contours around the Hawaiian Islands using the package rgdal and PBSmapping.? I have run into a memory limit when trying to combine two fairly small objects using cbind().? I have increased the memory to 4GB, but am being told I can't allocate a vector of size 240 Kb.? I am running R 2.11.1 on a Dell Optiplex 760 with Windows XP.? I have pasted the error message and summaries of the objects below.? Thanks for your help.? Tim>???? xyz<-cbind(hi.to.utm,z=b.depth$z)Error: cannot allocate vector of size 240 Kb> memory.limit()[1] 4000> memory.size()[1] 1971.68> summary(hi.to.utm)Object of class SpatialPoints Coordinates: ??????? min?????? max x? 708745.5? 923406.7 y 2046153.1 2327910.9 Is projected: TRUE proj4string : [+proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0] Number of points: 15328> str(hi.to.utm)Formal class 'SpatialPoints' [package "sp"] with 3 slots ? ..@ coords???? : num [1:15328, 1:2] 708746 710482 712218 713944 715681 ... ? .. ..- attr(*, "dimnames")=List of 2 ? .. .. ..$ : NULL ? .. .. ..$ : chr [1:2] "x" "y" ? ..@ bbox?????? : num [1:2, 1:2] 708746 2046153 923407 2327911 ? .. ..- attr(*, "dimnames")=List of 2 ? .. .. ..$ : chr [1:2] "x" "y" ? .. .. ..$ : chr [1:2] "min" "max" ? ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots ? .. .. ..@ projargs: chr " +proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0"> summary(b.depth)?????? x??????????????? y?????????????? z??????? ?Min.?? :-157.0?? Min.?? :18.50?? Min.?? :-5783? ?1st Qu.:-156.6?? 1st Qu.:18.98?? 1st Qu.:-4565? ?Median :-156.1?? Median :19.80?? Median :-3358? ?Mean?? :-156.1?? Mean?? :19.73?? Mean?? :-3012? ?3rd Qu.:-155.5?? 3rd Qu.:20.41?? 3rd Qu.:-1601? ?Max.?? :-155.0?? Max.?? :21.00?? Max.?? :??? 0?> str(b.depth)'data.frame':?? 15328 obs. of? 3 variables: ?$ x: num? -157 -157 -157 -157 -157 ... ?$ y: num? 21 21 21 21 21 ... ?$ z: num? -110 -114 -110 -88 -76 -122 -196 -224 -240 -238 ... ? Tim Clark Marine Ecologist National Park of American Samoa
On Oct 11, 2010, at 11:49 PM, Tim Clark wrote:> Dear List, > > I am trying to plot bathymetry contours around the Hawaiian Islands > using the > package rgdal and PBSmapping. I have run into a memory limit when > trying to > combine two fairly small objects using cbind(). I have increased > the memory to > 4GB, but am being told I can't allocate a vector of size 240 Kb. I > am running R > 2.11.1 on a Dell Optiplex 760 with Windows XP. I have pasted the > error message > and summaries of the objects below. Thanks for your help. Tim > > >> xyz<-cbind(hi.to.utm,z=b.depth$z) > Error: cannot allocate vector of size 240 KbYou have too much other "stuff". Try this: getsizes <- function() {z <- sapply(ls(envir=globalenv()), function(x) object.size(get(x))) (tmp <- as.matrix(rev(sort(z))[1:10]))} getsizes() You will see a list of the largest objects in descending order. Then use rm() to clear out unneeded items. -- David,> >> memory.limit() > [1] 4000Seems unlikely that you really have that much space in that 32 bit OS.>> memory.size() > [1] 1971.68 > >> summary(hi.to.utm) > Object of class SpatialPoints > Coordinates: > min max > x 708745.5 923406.7 > y 2046153.1 2327910.9 > Is projected: TRUE > proj4string : > [+proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0] > Number of points: 15328 > >> str(hi.to.utm) > Formal class 'SpatialPoints' [package "sp"] with 3 slots > ..@ coords : num [1:15328, 1:2] 708746 710482 712218 713944 > 715681 ... > .. ..- attr(*, "dimnames")=List of 2 > .. .. ..$ : NULL > .. .. ..$ : chr [1:2] "x" "y" > ..@ bbox : num [1:2, 1:2] 708746 2046153 923407 2327911 > .. ..- attr(*, "dimnames")=List of 2 > .. .. ..$ : chr [1:2] "x" "y" > .. .. ..$ : chr [1:2] "min" "max" > ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots > .. .. ..@ projargs: chr " +proj=utm +zone=4 +datum=NAD83 > +ellps=GRS80 > +towgs84=0,0,0" > > >> summary(b.depth) > x y z > Min. :-157.0 Min. :18.50 Min. :-5783 > 1st Qu.:-156.6 1st Qu.:18.98 1st Qu.:-4565 > Median :-156.1 Median :19.80 Median :-3358 > Mean :-156.1 Mean :19.73 Mean :-3012 > 3rd Qu.:-155.5 3rd Qu.:20.41 3rd Qu.:-1601 > Max. :-155.0 Max. :21.00 Max. : 0 > >> str(b.depth) > 'data.frame': 15328 obs. of 3 variables: > $ x: num -157 -157 -157 -157 -157 ... > $ y: num 21 21 21 21 21 ... > $ z: num -110 -114 -110 -88 -76 -122 -196 -224 -240 -238 ... > > > > Tim Clark > Marine Ecologist > National Park of American SamoaDavid Winsemius, MD West Hartford, CT
Hi, Probably Windows cann't allocate enough contiguous free space. Try this: Find boot.ini (usually at the root c:\) Without changing anything else, add this line at the end of the script: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional 3GB" /3GB /noexecute=optin /fastdetect Reboot. When prompted select the 3GB boot-up. Performance will decay but bigger objects could be saved to disk. Hope that this will be enough to get you code working. When finished re-boot and start with the normal boot-up. An example of a boot.ini script that I had to prepare for one big simulation work in an XP machine is at the end of my message. HTH Rubén [boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional 3GB" /3GB /noexecute=optin /fastdetect -----Original Message----- From: r-help-bounces@r-project.org on behalf of Tim Clark Sent: Tue 10/12/2010 5:49 AM To: r help r-help Cc: Tim Clark Subject: [R] Memory limit problem Dear List, I am trying to plot bathymetry contours around the Hawaiian Islands using the package rgdal and PBSmapping. I have run into a memory limit when trying to combine two fairly small objects using cbind(). I have increased the memory to 4GB, but am being told I can't allocate a vector of size 240 Kb. I am running R 2.11.1 on a Dell Optiplex 760 with Windows XP. I have pasted the error message and summaries of the objects below. Thanks for your help. Tim> xyz<-cbind(hi.to.utm,z=b.depth$z)Error: cannot allocate vector of size 240 Kb> memory.limit()[1] 4000> memory.size()[1] 1971.68> summary(hi.to.utm)Object of class SpatialPoints Coordinates: min max x 708745.5 923406.7 y 2046153.1 2327910.9 Is projected: TRUE proj4string : [+proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0] Number of points: 15328> str(hi.to.utm)Formal class 'SpatialPoints' [package "sp"] with 3 slots ..@ coords : num [1:15328, 1:2] 708746 710482 712218 713944 715681 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "x" "y" ..@ bbox : num [1:2, 1:2] 708746 2046153 923407 2327911 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:2] "x" "y" .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots .. .. ..@ projargs: chr " +proj=utm +zone=4 +datum=NAD83 +ellps=GRS80 +towgs84=0,0,0"> summary(b.depth)x y z Min. :-157.0 Min. :18.50 Min. :-5783 1st Qu.:-156.6 1st Qu.:18.98 1st Qu.:-4565 Median :-156.1 Median :19.80 Median :-3358 Mean :-156.1 Mean :19.73 Mean :-3012 3rd Qu.:-155.5 3rd Qu.:20.41 3rd Qu.:-1601 Max. :-155.0 Max. :21.00 Max. : 0> str(b.depth)'data.frame': 15328 obs. of 3 variables: $ x: num -157 -157 -157 -157 -157 ... $ y: num 21 21 21 21 21 ... $ z: num -110 -114 -110 -88 -76 -122 -196 -224 -240 -238 ... Tim Clark Marine Ecologist National Park of American Samoa ______________________________________________ R-help@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. [[alternative HTML version deleted]]