If you don't need linked lists, using plain arrays is probably more memory efficient.
update: perl should be fine with that kind of usage. just remember that perl is no where near as memory-efficient as C can be. perl values have a significant overhead. especially if you have many small objects.#!perl/bin/perl use strict; $|=1; my ($list1,$list2); print "Making list1\n"; for (0 .. 1_000_000) { my $head = $list1; $list1 = ["a" x 40,\$head]; } print "Making list2\n"; for (0 .. 60_000) { my $head = $list2; $list2 = ["b" x 338,\$head]; } print "Press enter to exit: "; my $dummy = <STDIN>;
update 2: i get a segfault from this script at destruction. that's not right. (tested perl 5.00504 & perl 5.8.8)
update 3: ok, increasing the stack size limit (ulimit -s 400000) fixes the problem.
In reply to Re: perl memory use question
by Joost
in thread perl memory use question
by exodist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |