in reply to perl memory use question
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl memory use question
by liverpole (Monsignor) on Jun 03, 2007 at 20:53 UTC | |
by Joost (Canon) on Jun 03, 2007 at 21:01 UTC | |
|
Re^2: perl memory use question
by exodist (Monk) on Jun 03, 2007 at 22:08 UTC | |
by Joost (Canon) on Jun 03, 2007 at 22:57 UTC |