in reply to Re^4: Memory management with long running scripts
in thread Memory management with long running scripts

To create a large string in memory without the create-then-copy, use:

my $x = chr(0); $x x= 500e6;

Now, when you undef $x, only the original 1 byte constant remains. All the rest is released back to the OS.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^6: Memory management with long running scripts
by AnomalousMonk (Archbishop) on Jul 22, 2012 at 01:45 UTC

    Ah! Works like a charm.