![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
How can I make my Perl program take less memory?by faq_monk (Initiate) |
on Oct 13, 1999 at 02:56 UTC ( #785=perlfaq nodetype: print w/replies, xml ) | Need Help?? |
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version: When it comes to time-space tradeoffs, Perl nearly always prefers to throw memory at a problem. Scalars in Perl use more memory than strings in C, arrays take more that, and hashes use even more. While there's still a lot to be done, recent releases have been addressing these issues. For example, as of 5.004, duplicate hash keys are shared amongst all hashes using them, so require no reallocation.
In some cases, using
Another thing to try is learning whether your Perl was compiled with the
system malloc or with Perl's builtin malloc. Whichever one it is, try using
the other one and see whether this makes a difference. Information about
malloc is in the INSTALL file in the source distribution. You can find out whether you are using
perl's malloc by typing
|
|