I think you just became the first person in the world who knows Date::Manip parsing internals better than myself!

Thanks for everything. I think this gives me enough information to track it down, though it's going to take me some time to really digest everything you said, but I think that this is enough to get me a long ways towards fixing the problem.

where I just matched on the regexp from _iso8601_rx. If I comment this line out (and just set $y,$m,$d to some static values), there's no leaking. Note that I STILL match the regexp, I simply never refer to the %+ hash.

Unfortunately, I wasn't able to reproduce this in a simple test script, so I still need to investigate further, but I think this is an interesting result.

If I modify $rx to include only one of the two choices, it doesn't leak. If I plug in a string which matches the first option (i.e. use the $string = "12" line), it doesn't leak. And if you comment out the @tmp = @+ line so you don't access %+, it doesn't leak.

At this point, I guess I no longer believe that it is a Date::Manip problem. In other words, I don't think the above script is buggy... I think it points out a bug in perl itself. If you agree, I think I'll pass it on as a perl bug.

There is another way of doing "named captures", without using the construct or %+ or %-. It's a bit um ... obscure, and may be slower, but it might allow you to workaround the problem in the interim without radically altering your existing code.

Note: The variables referenced inside the (?{ code }) blocks have to be global, but judicious use of local and our makes it reasonably convenient. Also, I've had iffy results using qr// with this. Never really understood why.

I realise that it would be considerable work to modify all your regex generators to use this method, but hey!

You can always knock up a few regex to do it for you ;)

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.

Thanks for the suggestion. I actually already tested this type of regexp (it was suggested in a previous question I posted about named captures: http://perlmonks.org/?node_id=810388). Unfortunately, the relatively simple tests I benchmarked weren't "a little slower". They were 7x slower!

So, unfortunately, I think I'm going to have to leave the current code in place meaning that there will be a problem for anyone using Date::Manip in a persistant program. Sooner or later, the problem will be fixed. I'm going to add a note to this affect to the documentation, but for now, I think that's going to be the extent of it.

Thanks again for an incredibly educational and fun (and frustrating... but not due to you) conversation!