Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
does this indicate that maybe the problem isn't (directly) with Date::Manip?

You might be right.

One source of leaks is the routine _iso8601_rx(). If you modify it:

sub _iso8601_rx { return ''; ...

This doesn't leak any more:

#!/usr/bin/perl -slw use Date::Manip::Date; $date = new Date::Manip::Date; #use Devel::LeakTrace::Fast; for (1..100e6) { $date->parse("2010-02-01 01:02:03"); }

Now that routine uses an extensive given/when construct, which I've had problems with in the past. And I think I've read other bug reports alluding to memory leaks associated with that construct previously.

To confirm my suspicion, I commented out the given( $rx ) { line and closing brace, and replaced all the whens with an if/elsif/else cascade. The result was that the rate of memory leak reduced markedly. Perhaps to 1/10 of the rate.

You do have 6 other given/when constructs in the file and I strongly suspect that if you replaced those similarly with if/elsif/else cascades, your memory leaks would abate even further, if not completely.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: Memory leak question by BrowserUk
in thread Memory leak question by SBECK

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (3)
    As of 2019-04-25 04:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      I am most likely to install a new module from CPAN if:
















      Results (125 votes). Check out past polls.

      Notices?
      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!