Dear All,

It seems that reference classes consume a lot of memory which became a problem 
for my rather extensive simulation. 
I prepared a small example. An instance of this minimal class uses about 20K on 
disk. 

rm(list=ls(all=TRUE));

MySmallClass = setRefClass("MySmallClass", 
     fields = list(
                myField = "numeric"
     ),
     methods = list(
           initialize = function(f) {
             myField <<- f;
         })        
);

o = MySmallClass$new(10);
saveRDS(o, file="C:\\o.rds");
file.info("C:\\o.rds")$size;


Result:
[1] 21274

My questions:
Is saveRDS() is representative for memory usage?
If so, is there a way to shrink these objects to a smaller size?

I use R 2.15.0 on a 32 Bit Windows 7 system.

Best regards,
Jan

______________________________________________
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.

Reply via email to