Changing the code doesn't change whether or not leaktrace detects any leaks, including putting the subroutine in the innermost loop. How could I do this without %haystack, since if there are actually no memory leaks I think that would probably be much less of a drag on my computer? & simpler is better imho. I'm open to anything that would work. The function no_leaks_ok says there aren't any leaks so I'm with you there but leaktrace -verbose says

leaked REF(0x24810cc) from quarticmod.pl line 42.<BR> 41: 42: $haystack{"$x, $y, $z"} = [ 43: poly_roots( SV = IV(0x24810c8) at 0x24810cc REFCNT = 1 FLAGS = (ROK) RV = 0x248101c SV = PVAV(0x247e750) at 0x248101c REFCNT = 1 FLAGS = () ARRAY = 0x24fdbe4 FILL = 2 MAX = 2 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = NV(0x1989d9c) at 0x248102c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 2.6180339887499 Elt No. 1 SV = NV(0x1989f8c) at 0x248103c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 1.5 Elt No. 2 SV = NV(0x1989f9c) at 0x248104c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 0.381966011250106 leaked SCALAR(0x248104c) from quarticmod.pl line 42. 41: 42: $haystack{"$x, $y, $z"} = [ 43: poly_roots( SV = NV(0x1989f9c) at 0x248104c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 0.381966011250106 leaked SCALAR(0x248103c) from quarticmod.pl line 42. 41: 42: $haystack{"$x, $y, $z"} = [ 43: poly_roots( SV = NV(0x1989f8c) at 0x248103c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 1.5 leaked ARRAY(0x248101c) from quarticmod.pl line 42. 41: 42: $haystack{"$x, $y, $z"} = [ 43: poly_roots( SV = PVAV(0x247e750) at 0x248101c REFCNT = 1 FLAGS = () ARRAY = 0x24fdbe4 FILL = 2 MAX = 2 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = NV(0x1989d9c) at 0x248102c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 2.6180339887499 Elt No. 1 SV = NV(0x1989f8c) at 0x248103c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 1.5 Elt No. 2 SV = NV(0x1989f9c) at 0x248104c REFCNT = 1 FLAGS = (NOK,pNOK) NV = 0.381966011250106 The size of haystack is 129 bytes. The size of haystack including references is 265 bytes. The size of wants is 36 bytes. The size of wants including references is 36 bytes.

In reply to Re^4: help with memory leak by crunch_this!
in thread help with memory leak by crunch_this!

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.