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

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

Thread Previous | Thread Next
Tony Cook
April 22, 2014 14:01
Re: [perl #121676] Memory leak in backticks and system
Message ID:
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

> 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

> > 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 . 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.


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