in reply to Re^4: Memory leak question
in thread Memory leak question
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Memory leak question
by SBECK (Chaplain) on Oct 05, 2010 at 15:46 UTC | |
by BrowserUk (Patriarch) on Oct 05, 2010 at 16:03 UTC | |
by SBECK (Chaplain) on Oct 05, 2010 at 19:03 UTC | |
by BrowserUk (Patriarch) on Oct 05, 2010 at 19:54 UTC | |
by SBECK (Chaplain) on Oct 05, 2010 at 20:09 UTC | |
|