Total memory size of collections

how can I get the total memory size of arrays.
using sizeof does not give the total memory footprint.
for example,

sizeof([1])==sizeof(["a"])==sizeof(["abcdef"])

and

sizeof([[1,2],[3,4]])==sizeof([[1,2,0],[3,4,0]])

Is the data stored contiguously memory? or does it store references to other objecrs?

suppose I want to hash the object; how can I get a starting address (Ref(x)?) and total memory size?

Base.summarysize will do what you want here.

2 Likes