Skip Menu |

This queue is for tickets about the List-MoreUtils CPAN distribution.

Report information
The Basics
Id: 58325
Status: resolved
Priority: 0/
Queue: List-MoreUtils

People
Owner: Nobody in particular
Requestors: airwave [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.22
  • 0.25_02
Fixed in: 0.400_004



Subject: apply leaks memory
The XS implementation of apply leaks memory on perl 5.10.1. Here is a simple loop that you don't want to leave running: use List::MoreUtils qw(apply); while (1) { apply { } (1); }
See patch in the attachment. For those, who'd like to investigate more - i think it's impossible to patch this without introducing second loop either before or after main one, as POP_MULTICALL prevents any attempt to carry mortal'ized vars over it. So, either pre-allocate space or mark as mortal afterward.
Subject: apply.patch
--- MoreUtils.xs 2006-07-02 19:25:16.000000000 +0400 +++ MoreUtils.xs.new 2010-10-14 14:33:59.000000000 +0400 @@ -603,7 +603,9 @@ } POP_MULTICALL; - done: + for (i = 0; i < items - 1; ++i){ + sv_2mortal(args[i]); + } XSRETURN(items-1); }
I'll care of it as soon as I find a tuit. Thanks
I've disabled the XS apply in 0.27_04 until Jens has time to fix it properly.