Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: hv_store_ent

by rpc (Monk)
on Jan 18, 2001 at 01:15 UTC ( #52616=note: print w/replies, xml ) Need Help??


in reply to hv_store_ent

This may be your problem.
From the perlguts manpage:

Note that both `hv_store' and `hv_store_ent' do not increment the reference count of the stored `val', which is the caller's responsibility. If these functions return a NULL value, the caller will usually have to decrement the reference count of `val' to avoid a memory leak.

Maybe create the SV with:

SV *val = sv_newmortal();
Or mortalize it with:
sv_2mortal(val);
Might work? You might need to Mortalize 'key' too.

Replies are listed 'Best First'.
Re: Re: hv_store_ent
by bmdhacks (Novice) on Jan 18, 2001 at 01:46 UTC
    Yeah, ignore the non error-checking nature of that sample code, I just did it for brevity. The motality of the 'key' SV is where my question lies. Can anyone verify that I need to kill it (or decrement it's reference count) after passing it to hv_store_ent?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2023-02-04 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (30 votes). Check out past polls.

    Notices?