Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560481]
help
Chatterbox?
[choroba]: As discussed in Using the DATA file handle for ARGV, I usually start my "fun" scripts with *ARGV = *DATA{IO} unless @ARGV;
[choroba]: this was just a remainder
[Discipulus]: ah thanks i forgot that thread (even if i saved it in my homenode)..
[Discipulus]: the node i discovered yesterday nigth was also interesting

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2016-12-06 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (101 votes). Check out past polls.