in reply to Measurement of physical memory

Well, there are things like Devel::Peek, but in general finding out how much memory that a variable takes up is a rather dodgy process in perl. A good rule of thumb for a plain scalar is about 28 bytes plus the length of the string. Double that base number if you're on a 64 bit machine. (Note that 28 bytes is not exact, as it can vary depending on build options and such) The largest a scalar can get on a 32 bit machine is somewhere around 140 bytes plus string data.

Arrays generally take up 4 (or 8, on 64 bit systems) bytes times the highest array index it has been since the last time it was undef'd as a single contiguous chunk. (Though it might take up to 20% more, depending on how the array grew) Then tack on about 40 bytes of overhead.

Hashes are odd, and it depends on how they grew and how many buckets they have. hv.c and hc.h are left as an exercise for the reader if you really want to know.