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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Beware List::MoreUtils natatime()!
by moritz (Cardinal) on Feb 09, 2009 at 09:21 UTC | |
|
Re: Beware List::MoreUtils natatime()!
by JavaFan (Canon) on Feb 09, 2009 at 10:17 UTC | |
by diotalevi (Canon) on Feb 10, 2009 at 07:13 UTC | |
by JavaFan (Canon) on Feb 10, 2009 at 07:55 UTC | |
by diotalevi (Canon) on Feb 10, 2009 at 08:03 UTC | |
by jdporter (Paladin) on Feb 10, 2009 at 11:48 UTC |