develooper Front page | perl.perl5.porters | Postings from April 2014

Re: [perl #121676] Memory leak in backticks and system

Thread Previous | Thread Next
From:
Tony Cook
Date:
April 22, 2014 14:01
Subject:
Re: [perl #121676] Memory leak in backticks and system
Message ID:
20140422140135.GB28023@mars.tony.develop-help.com
On Tue, Apr 22, 2014 at 04:41:00AM -0700, bulk88 via RT wrote:
> On Mon Apr 21 23:33:16 2014, tonyc wrote:
> > I tried to fudge the build (and added some extra code) to build perl
> > with MSVCRT's debug version memory leak reporting[1], which reported
> > only a single leak, which appears with perl -e0 or perl -e "`dir` for
> > 1..100`".
> > 
> 
> I've never used debugging CRT with Perl. Its on my very long todo list. Since you got it to compile, may I suggest you implement the feature in the makefiles?

I had to fiddle with the source a bit, the macro in perl.h:

#define CALLREGFREE_PVT(prog) \
    if(prog) RX_ENGINE(prog)->free(aTHX_ (prog))

fails pretty hard when the CRT defines a free() macro.

Also, I could only get the results to show in the debugger, not on the
console.

> I've always thought that PERL_DESTRUT_LEVEL and debugging CRT would conflict since perl doesn't free all memory on normal exists unless psuedo-fork has been called which sets PERL_DESTRUCT_LEVEL.

You can build a -DDEBUGGING perl and set PERL_DESTRUCT_LEVEL=2 in the
environment.

> > I don't see a leak if I build perl with PERL_MALLOC defined (which
> > requires disabling USE_IMP_SYS).
> > 
> > I don't see a leak with all of PERL_MALLOC, USE_MULTI, USE_ITHREADS,
> > USE_IMP_SYS undefined.
> > 
> > No leak with just USE_MULTI re-enabled out of those.
> > 
> > Right now I suspect something in the USE_IMP_SYS layer.
> > 
> 
> Did you see the leak in any config? I saw some strange reproducibility which had no identifyable pattern, since it wasn't tied to CRT dll or compiler, in http://www.nntp.perl.org/group/perl.perl5.porters/2014/04/msg214405.html . The leak can be clearly seen in Task Manager. Its about 200-300 KB a second/a screen refresh in task manager.

A USE_IMP_SYS build did leak.

Tony

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About