[R] Memory problem
Manfred W. Baumstark
maba at ukl.uni-freiburg.de
Sat Dec 8 17:00:08 CET 2001
Uwe Ligges asked me to produce a more simple example. Ok, the problem is as
follows: If I write big files memory utilization grows constantly. Here it
is a little test program, and it's output:
imv <- integer(length = 3000000)
memory.profile()
round(memory.size()/1048576.0, 2)
for (j in 1:20) {
imout <- file(paste("test", j, sep=""), "wb")
writeBin(1:2, imout, size=2, endian="big")
writeBin(imv, imout, size=2, endian="big") # this one makes the problem
close(imout)
}
memory.profile()
round(memory.size()/1048576.0, 2)
Manfred
############ Write 20 big files
> imv <- integer(length = 3000000)
>
> memory.profile()
NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP
LANGSXP
1 4080 104244 1280 4 0
53027
SPECIALSXP BUILTINSXP CHARSXP LGLSXP
INTSXP
59 483 10886 1510 0 0
24
REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP
EXPRSXP
6693 4 6581 0 0 8
0
EXTPTRSXP
0 0
> round(memory.size()/1048576.0, 2)
[1] 20
> for (j in 1:20) {
+
+ imout <- file(paste("test", j, sep=""), "wb")
+ writeBin(1:2, imout, size=2, endian="big")
+ writeBin(imv, imout, size=2, endian="big") # this one makes the problem
+ close(imout)
+ }
> memory.profile()
NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP
LANGSXP
1 4081 104262 1280 4 0
53027
SPECIALSXP BUILTINSXP CHARSXP LGLSXP
INTSXP
59 483 10929 1510 0 0
26
REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP
EXPRSXP
6693 4 6583 0 0 8
0
EXTPTRSXP
0 0
> round(memory.size()/1048576.0, 2)
[1] 134.44
>
############ Write 20 small files
> imv <- integer(length = 3000000)
>
> memory.profile()
NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP
LANGSXP
1 4080 104244 1280 4 0
53027
SPECIALSXP BUILTINSXP CHARSXP LGLSXP
INTSXP
59 483 10886 1510 0 0
24
REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP
EXPRSXP
6693 4 6581 0 0 8
0
EXTPTRSXP
0 0
> round(memory.size()/1048576.0, 2)
[1] 20
> for (j in 1:20) {
+
+ imout <- file(paste("test", j, sep=""), "wb")
+ writeBin(1:2, imout, size=2, endian="big")
+ # writeBin(imv, imout, size=2, endian="big") # this one makes the
problem
+ close(imout)
+ }
> memory.profile()
NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP
LANGSXP
1 4081 104261 1280 4 0
53027
SPECIALSXP BUILTINSXP CHARSXP LGLSXP
INTSXP
59 483 10909 1510 0 0
26
REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP
EXPRSXP
6693 4 6583 0 0 8
0
EXTPTRSXP
0 0
> round(memory.size()/1048576.0, 2)
[1] 20
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maba.vcf
Type: text/x-vcard
Size: 356 bytes
Desc: Card for Manfred W. Baumstark
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20011208/3307af36/maba.vcf
More information about the R-help
mailing list