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

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

Thread Previous | Thread Next
Steve Hay
April 22, 2014 19:33
Re: [perl #121676] Memory leak in backticks and system
Message ID:
On 22 April 2014 15:01, Tony Cook <> wrote:
> 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 had a crack at using the debug CRT a year or more ago and ran into
the free() problem too, and also trouble with the invalid parameter
handler choking on filehandles getting closed when they are already
closed. I have it on my TODO list to revisit this and get it working
too; maybe the three of us can finally get somewhere with it after
5.20 is out?!

FWIW, here's the patch that I was playing with last. It's well over a
year out of date, but I'm sure it could still be manually applied if
all else fails. (Sorry, it's also git diff style again. I've not
forgotten to avoid this in the future...)

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