I just got done tracking down a nasty memory leak due to my use of natatime(). It's not a function I've ever used before but it seemed convenient enough.
Run this code and watch the memory use grow:
use List::MoreUtils qw(natatime); my $count = 0; while (1) { my @rows = ("...") x 100; my $it = natatime(10,@rows); while(my @chunk = $it->()) { $count += @chunk; if ($count % 1000 == 0) { warn "COUNT : $count\n"; } } }
I haven't dug any deeper than this, so I'm not sure if it's something in List::MoreUtils XS code or a side-effect of using a closure for the iterator, or what. I'm also going to send this to the maintainer, so no need to remind me!
UPDATE: It would seem to be an XS bug - setting the environment var LIST_MOREUTILS_PP=1 makes it go away.
UPDATE 2: Corion asked, so I'll tell you - this is List::MoreUtils v0.22 on Perl v5.8.8. Oh, and the maintainer's email address doesn't work. Anybody want to take over and fix this?
-sam
Back to
Meditations