First off, Perl has garbage collection, but
does not release memory back to the OS. That is an important distinction that needs to be made. This means that if you have data structures you keep adding to, you will keep using more memory that will never be released. Perl simply marks areas that can be reused.
Secondly, depending on what version of Perl you're using, you might have a genuine memory leak. If you're not using 5.6.1, then I would suggest upgrading and trying again to see if the problem is still there.
Also, depending on your version of Tk, you might have memory leaks/circular references there. Many of the more complex packages can have memory leaks, especially earlier versions. Upgrade to the latest version of that.
Lastly, and most importantly, do NOT use global variables. Use lexical variables, declared using my within logical structures. That way, you aid Perl's memory allocations and bhelp free up more memory.
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.