develooper Front page | perl.perl5.porters | Postings from June 2016

Re: [perl #128313] Memory leak in perl 5.24.0 when use re qw[strict]is used

Thread Previous | Thread Next
Karl Williamson
June 8, 2016 17:04
Re: [perl #128313] Memory leak in perl 5.24.0 when use re qw[strict]is used
Message ID:
On 06/08/2016 10:44 AM, demerphq wrote:
> On 8 June 2016 at 18:27, Dan Collins <> wrote:
>> Vaguely, yes...but I realize that I may not have set  *posix_warnings =
>> warn_text;, and I may have accidentally commented out the whole line. :(
>> Does that pass tests for you?
> Yes it passed all tests here.
> I pushed it just now:
> commit ee072c898947f5fee316f1381b29ad692addcf05
> Author: Yves Orton <>
> Date:   Wed Jun 8 18:42:30 2016 +0200
>      [perl #128313] Fix leak in perl 5.24 with strict and regex posix
> char classes
>      This patch is a refinement of one written by Dan Collins.
>      Any thanks for this patch should go to him.
> Yves

I'm concerned that you guys are falling into the same trap I did 
earlier.  The problem with mortalizing is that it can lead to excessive 
memory use, as those temps don't get freed immediately.  See
In a large pattern, this can be called over and over and over.  It may 
not be a problem, but it might be, and that needs to be considered. 
This doesn't appear to have the potential to use large amounts of memory 
per scalar like what was reported in that ticket.  So it may be ok.

If it isn't ok, one option is to add this mortalization only if it's re 
'strict'.  Another would be to make the return into a macro that frees 
the space before returning.  This would solve the 'ugliness' issue.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About