http://qs1969.pair.com?node_id=6615


in reply to Why Thrash Memory?

For the most part, Perl's garbage collection will handle discarding variables and cleaning up for you automatically. As you suggest, if you're mindful of the imminenet death of a variable scope, don't worry about calling undef.

With that in mind, there are a couple of places where you might want to massage things by hand.

The first is the only one I'd really worry about -- with some thoughtful programming, the second may never come up. I really don't worry about it much, as wise coding tends to minimize memory usage anyway.

Replies are listed 'Best First'.
RE: Re: Why Thrash Memory?
by btrott (Parson) on Apr 01, 2000 at 01:16 UTC
    Re: #1--if you're interested, Perl 5.6 has (experimental) support for weak references, meaning that you can use circular references (as one example) and have the standard garbage collection work for you. A weak reference doesn't increment the reference count of the thing to which it refers.

    You'll need the WeakRef module.