how many bytes per $scalar, $ref2something and the like?

R

Ralf Wahner

Dear Masters of Perl

I've been searching for a long time for an answer on the question how much
memory the data structures of Perl require. Usually, say, a floating point
number of double precision gets eight bytes and an integer four bytes.
So far I couldn't find out, how many bytes Perl takes to store

- a scalar $a
- a reference to a scalar, array, hash or subroutine

Since arrays and hashes consist of scalars themselves, this should be
sufficient for estimating the memory usage of arbitrary data structures.

Background: I'm writing my diploma thesis on numerical mathematics. At the
moment I'm finishing a grid generator. Since the program needs a vast amount
of data in order to write the grid files the memory usage grows very fast
for huge grids. It appears that my program either produces a memory leak or
actually runs out of memory. In order to find the reason it would be a great
help to estimate the memory usage of the data structures. Unfortunately, I
couldn't find a hint on how much memory Perl allocates for its data types.

Any tip is gratefully appreciated. Thanks in advance,

Ralf
 
A

! aaa

Perl uses your C compiler's defaults for most of this - but - maybe you've
stepped too far into the problem?

I beleive you can "tie" perl variables and structures to files, giving you
hundreds of gigs
of "memory" to play with, just the same as using real memory. Should let
you go back
and concentrate on the problem, no?

A terabyte (5 x 200gig drives) is less than $1000 on ebay nowdays, BTW :)
 
R

Ralf Wahner

Dear unknown Helper

Thank you very much for your tip. Haven't been utilizing tied variables
until now. Continuously rummaging the O'Reilly Perl Bookshelf because I
came to Perl during the end of the last year and have not much experience,
yet. I take you as a good example. Hope to be able to help beginners soon,
too.

Best regards,

Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top