Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^8: perlembed: mortalize an AV or not (Perl leak)

by tye (Sage)
on Jul 11, 2006 at 14:55 UTC ( #560481=note: print w/ replies, xml ) Need Help??

in reply to Re^7: perlembed: mortalize an AV or not (misc)
in thread perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory

Someone asked about the Perl memory leak I spotted. Rather than try to put code into a /msg, I'll just include it here, that way anyone can point out that I'm mistaken. From line 3113 of op.c, Perl v5.8.0:

repointer = newSViv(0); av_push(PL_regex_padav,SvREFCNT_inc(repointer));

newSViv() gives a ref count of 1. av_push() doesn't change ref count so the SvREFCNT_inc() leaves a ref count of 2 but repointer is not subsequently used so we've made one reference to it so we've got a memory leak.

I'm hoping the person who asked will perlbug this and save me the bother (not talking to p5p is always an advantage, IMO), but we'll see what happens. :)

- tye        

Comment on Re^8: perlembed: mortalize an AV or not (Perl leak)
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560481]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-11-27 07:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (719 votes), past polls