in reply to Is there a way to find the size of a data structure?
Scalars containing text, use around 4*9+len bytes on 32bit computers. Scalars with numbers sometimes use less memory.
Arrays use 4*(9+len) bytes plus the memory used by the contained items.
Hashes are a bit more complex, specially as keys can be shared, but roughly, they eat 4*(13+7*n_items) bytes plus all the key sizes (plus malloc overhead) plus the memory used by the elements.
|
|---|