It should be possible to calculate object.size in the presence of
sharing, at least with respect to all sub-nodes of a SEXP. E.g.,
during calculation, keep a hash of all SEXP pointers visited. If a
pointer has already been visited, add only the size of the pointer to
the total object size.
Trave
On 1/22/19 6:17 PM, Kevin Ushey wrote:
I think that object.size() is most commonly used to answer the question,
"what R objects are consuming the most memory currently in my R session?"
and for that reason I think returning the size of the internal
representations of objects (for e.g. ALTREP obje
I think that object.size() is most commonly used to answer the question,
"what R objects are consuming the most memory currently in my R session?"
and for that reason I think returning the size of the internal
representations of objects (for e.g. ALTREP objects; unevaluated promises)
is the right d
On Mon, 21 Jan 2019, Martin Maechler wrote:
>> Travers Ching
>> on Tue, 15 Jan 2019 12:50:45 -0800 writes:
>
>> I have a toy alt-rep string package that generates
>> randomly seeded strings. example: library(altstringisode)
>> x <- altrandomStrings(1e8) head(x) [1]
>>
> Travers Ching
> on Tue, 15 Jan 2019 12:50:45 -0800 writes:
> I have a toy alt-rep string package that generates
> randomly seeded strings. example: library(altstringisode)
> x <- altrandomStrings(1e8) head(x) [1]
> "2PN0bdwPY7CA8M06zVKEkhHgZVgtV1"
> "5PN2qmWqBlQ
Thanks for the detailed response, Gabriel!
I think that an object_size alt-rep method that package developers
need to implement might be hard to get right. One alternative could
be an alt-rep method that returns the number of bytes/characters in a
given string element since I believe the object s
Travers,
Great to hear you're trying out the ALTREP stuff, good on you :).
Did you mean the get_altstring_Elt_method? I see the code in size.c within
utils that grabs each element, but I don't see any setting (and the setters
are noops currently anyway they just do things the old way).
One thing
I have a toy alt-rep string package that generates randomly seeded strings.
example:
library(altstringisode)
x <- altrandomStrings(1e8)
head(x)
[1] "2PN0bdwPY7CA8M06zVKEkhHgZVgtV1" "5PN2qmWqBlQ9wQj99nsQzldVI5ZuGX" ... etc
object.size(1e8)
Object.size will call the set_altstring_Elt_method for eve