I've just added an undef ....; to the end of all relevent functions
to correspond with all the my ......;
Whether undef-ing works, depends on what exactly you undef.
In the trivial example above, undef $h at the end of the loop wouldn't help (as that's implicitly
happening anyway), while undef %$h, undef $h->{myself} or delete $h->{myself} would help.
Point is that you have to break the circle before the data structure becomes unreachable...
In real life, self-referencing circles are often not immediately
evident, as they may come into being indirectly through several data
structures, e.g. A references B, which references C, which ...
references A — or some such. Your ref counts > 1 might hint at
such a situation, unless you have another good explanation for them :)
Sometimes (if all else fails), it helps to step by step disable
parts of the program, until the problem goes away. In this case, look
more closely into whatever that last part was, etc. — Without
seeing any actual code, it's hard to come up more specific tips.
-
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.
|