http://www.perlmonks.org?node_id=267209

batkins has asked for the wisdom of the Perl Monks concerning the following question:

After reading Does Perl have garbage collection mechanism and how it performs?, I began to wonder how useful it would be to modify my Perl installation to free memory after a refcount hits 0.

You see, I've written a Perl application that I distribute for both Linux and Win32. My Win32 distros include a copy of perl58.dll, since most of my Win32 users don't have Perl installed (or have any desire to install it).

The trouble is that at least two of my users have seen the large amounts of memory my app can use (sometimes up to 28MB - I assume that my usage of Tk and Tk::Photo in particular are part of the problem) and subsequently refused to use my app, insisting that it had memory leaks. I tried to explain that most of that memory gets swapped out to disk anyway, but it was in vain.

So if I modified the Perl source to free its memory after a reference goes out of scope and distributed the recompiled DLL, would that lower my app's memory usage and appease these users?

(Please don't flame me - this is just an idea :)

Bill