I disagree with some of your analysis. @$av= (); vs. $av= [ ]; only matters if you are leaking references to the original (anonymous) array (such as via circular references). Your "fix" reduces the impact of the leak that makes the unreferenced anonymous array not get destroyed.

But I'm not particularly surprised to find unreferenced things not being destroyed when using Tk. When I've used Tk I've had to be careful to not create a lot of anonymous things because it appeared that Tk was prone to preventing things from being destroyed. Part of this may have been due to the problem of closures causing Perl to create its own circular references but I thought there was more to it than that. But having bugs in ref counting and related stuff is almost assured when you have that volume of XS code.

- tye        


In reply to Re: Adventures in Debugging a Perl/Tk Game (other leak) by tye
in thread Adventures in Debugging a Perl/Tk Game by liverpole

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.