[Rd] object.size vs lobstr::obj_size

Hervé Pagès hp@ge@ @end|ng |rom |redhutch@org
Fri Mar 27 16:39:15 CET 2020


Hi Tomas,

On 3/27/20 07:01, Tomas Kalibera wrote:
> they provide an over-approximation

They can also provide an "under-approximation" (to say the least) e.g. 
on reference objects where the entire substance of the object is ignored 
which makes object.size() completely meaningless in that case:

   setRefClass("A", fields=c(stuff="ANY"))
   object.size(new("A", stuff=raw(0)))      # 680 bytes
   object.size(new("A", stuff=runif(1e8)))  # 680 bytes

Why wouldn't object.size() look at the content of environments?

Thanks,
H.

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages using fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the R-devel mailing list