[Israel.pm] Garbage Collection Question

Yuval Yaari yuval at windax.com
Sat May 8 14:53:42 PDT 2004

Issac Goldstand said:
> Even if the GC does collect it AFAIK it will not release the memory back
> to the system until Perl exits - rather it will save the memory for
> other variables (or anything else in the Perl process which wants it).
> Maybe I'm remembering wrong, though...

Thanks for pointing this out.
You are right:

"The way Perl handles memory is very simple. When it needs to allocate
memory it will allocate everything it needs to perform it's tasks. For
example, if a variable's content is 1MB, then Perl will allocate 1MB for
the variable. When that variable goes out of scope or is catched by the
garbage fairy, Perl will not release that 1MB to the kernel right away, it
will reuse it in case it needs it later on during execution."

I assume, but not 100% sure, that this is also true to the undef scenario.

I should take this in account next time I use big data structures in a
mod_perl environment :)


More information about the Perl mailing list