[R] memory management

Sam Steingold sds at gnu.org
Tue Feb 28 23:55:47 CET 2012


> * William Dunlap <jqhaync at gvopb.pbz> [2012-02-28 20:19:06 +0000]:
>
> Look into environments that may be stored with your data.

thanks, but I see nothing like that:

for (n in ls(all.names = TRUE)) {
  o <- get(n)
  print(object.size(o), units="Kb")
  e <- environment(o)
  if (!identical(e,NULL) && !identical(e,.GlobalEnv)) {
    print(e)
    print(eapply(e,object.size))
  }
}
25.8 Kb
0.5 Kb
49.1 Kb
0.1 Kb
30.8 Kb
13.6 Kb
17.4 Kb
59.4 Kb
52.2 Kb
0.1 Kb
3.9 Kb
49.1 Kb
21.2 Kb
0.1 Kb
0.1 Kb
51 Kb
13.2 Kb
53.5 Kb
18.1 Kb
64.3 Kb
25.8 Kb
33.5 Kb
0.1 Kb
0.1 Kb
8 Kb
10 Kb
15.7 Kb
15.6 Kb
9.9 Kb
401672.7 Kb
19.1 Kb
76 Kb
12 Kb
32.4 Kb
156.3 Kb
13.1 Kb
20.5 Kb
21.8 Kb
10.8 Kb

sum(unlist(lapply(lapply(ls(all.names = TRUE),get),object.size)))
[1] 412351928

i.e., total of data is about 400MB.
why does the process take in access of 1GB?

top: 1235m 1.1g 4452 S    0 14.6   7:12.27 R

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://pmw.org.il http://camera.org
http://dhimmi.com http://palestinefacts.org http://ffii.org
Fighting for peace is like screwing for virginity.



More information about the R-help mailing list