in reply to Re: memory usage/leaks
in thread memory usage/leaks

<ahem>
Perl most certainly does have real garbage collection. Reference counting is one of several GC techniques.
</ahem>

One of the shortcomings of reference counting as a memory management technique is the problem of circular references. If you manage to get a Perl data structure to point to itself, all elements will continue to have non-zero reference counts even if nobody else points to the data structure. The structure hangs around in memory until the program terminates.

There are two other likely causes of memory leaks in Perl programs. First, there are known memory leaks in some version of Perl with eval.

A second source of leaks are with modules that use XS modules, which are linked into the application at runtime. If C code in the XS module doesn't correctly clean up after itself, external resources (e.g., resources not visible directly to Perl) can leak. Tk uses XS. You might be running into a leak in whichever version you're using.