in reply to Clearing an Array of Array's from memory

I believe it was Tom Christiansen that said during a talk on Perl at a Lisa Conference "a variable in Perl only lives as long as someone cares about it". Meaning that if you undef it or otherwise stop referencing it Perl will get rid of it. What is not clear to me is if Perl will release the memory back to the system or if it will just make it available for other variables to use.


Peter L. Berghold -- Unix Professional
Peter at Berghold dot Net
Chat Stuff: AIM:  redcowdawg
Yahoo: blue_cowdawg
Cowdawg Philosophy:  Sieze the Cow! Bite the Day!
Clever Quip:  Nobody expects the Perl Inquisition!
Non-Perl Passion:   Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.
  • Comment on Re: Clearing an Array of Array's from memory

Replies are listed 'Best First'.
Re: Re: Clearing an Array of Array's from memory
by hardburn (Abbot) on Aug 29, 2003 at 16:50 UTC

    Freed variables are made available for other variables. The system only gets it back when the process ends.

    Update: Fixed typo.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

      This is incorrect. Whether the freed space is returned to the operating system is OS, OS version, C library, and allocation size dependent. Memory is released back to the OS in many places, including Linux and Win32 (which are two of the more common OSes perl's used on)