in reply to garbage collection guts

Have you read the FAQ entry on this? Memory used and free-d by Perl is not released to the O/S (except in MacOS, if I recall correctly), so the apparent memory usage will not go down, but that memory is still available for Perl to re-use for other items.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: garbage collection guts
by Dominus (Parson) on Nov 13, 2000 at 21:48 UTC
    Memory can be released to the OS on any system that supports it. If Perl is compiled to use the system malloc() (rather than its own internal version of malloc()) then it does whatever the system malloc() does. All of which would be an academic point, except that on GNU/Linux systems with glibc2, the system malloc() does return memory to the O/S if it thinks that might be beneficial.

    I was really surprised when I found this out. My Perl program was chugging along, and it suddenly got smaller. I couldn't believe my eyes. I had to spend the next hour digging into the source code of the free() function until I found the responsible code.

    The guy who wrote that malloc() package is a genius.

RE: Re: garbage collection guts
by Anonymous Monk on Nov 13, 2000 at 18:30 UTC
    Which FAQ is that? I read the OO faqs (perltoot,perlobj, perlbot, as well as searched PAN && perlmonks 4 garbage collection), but appart from the stuff about self-reffing obj. in the BOT, I did not find anything other than the OOstuff. Your answer explains what is happening here, anyway, so thanks. But I would like a pointer so that I can read up for myself.