"Michael C. Davis" wrote:

> Hi, is there a good way to tell how much memory a given data structure is
> consuming?  I realize that there are issues in using this number to
> determine runtime memory requirements (like the fact that, in some
> circumstances, a running Perl process does not give back allocated memory
> to the operating system until the process exits) but ... are there
> guidelines like 100 bytes per REF, for example?  Or is there a routine to
> which I can pass my data structure and have it tell me the size?  Thanks!

My suggestion would be to fill containers with variables of whatever kind you
are interested in, and use system monitoring tools to see how much memoryu your
process consumes.  When I did some exrcises testing for memory usage, for
instance, the readings indicates that empty anonymous hashes could take about
60-70 bytes apiece.  This ballpark figure was good enough for me.  It may be
that, by perusing
perldoc perlguts
you can garner sufficiient information to precisely calculate what the memory
cost of any scalar or container is.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to