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
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