If I understand your question correctly, you can create a complex structure (i.e., hash of hashrefs, of hashrefs, etc.) and reference a particular object (array, hash, perl object, etc.) more than one place within the structure (i.e., multiple dependencies refer to it). Perl will not become confused by this, as evidenced by the following.
my @test = qw( a list of words ); my %test = ( keyword => 1, value => 2) my %outer = ( hash => \%test, array => \@test); $outer{another_hash}=\%test; # add same value with another key
When this is dumped within the Perl debugger, Perl recognizes that it has already encountered the hashref and says so:
DB<1> x \%outer 0 HASH(0xc881d4) 'another_hash' => HASH(0xc858c0) 'keyword' => 1 'value' => 2 'array' => ARRAY(0xc85950) 0 'a' 1 'list' 2 'of' 3 'words' 'hash' => HASH(0xc858c0) -> REUSED_ADDRESS DB<1>
Since it eschews C-style pointers, Perl manages its own heap quite well, and it is *VERY* difficult to screw up. As long as the OS has memory to give, a perl process can use as much as it needs (in my humble experience). I've seen perl processes using upwards of 1Gb of memory.
Of course, it helps if you design your structures to be as efficient as possible, as with any language.
dmm
You can give a man a fish and feed him for a day ...In reply to Re: Memory allocation
by dmmiller2k
in thread Memory allocation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |