I think there may be confusion about what constitutes a "memory leak". A memory leak occurs if memory is not freed at the point the last reference to that memory goes away. There are 3 ways to get a memory leak in a perl program: construct a circular reference (as described by other comments above); find and tickle a bug in perl's reference counting; or find and tickle a bug in some other external non-perl code (such as an XS library).
It is possible to write a program that consumes more memory than it needs to because it keeps unnecessary references to data, thus making the memory unavailable for reclamation. But that is simply an inefficiency in the program (often fixable by more carefully restricting the scope of variables), not a memory leak.
Hugo
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|