Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Yes or no? Perlguts and perlapi don't say. All they say is that hv_store() and company don't increment the refcount of what gets stored.
I ask because I have a bit of code where one routine creates a scalar and adds it to a hash, and another deletes and destroys that scalar. After the call to hv_delete(), I call SvREFCNT_dec() on the SV * returned, and get an error for trying to decrement the refcount of scalar whose refcount *already* dropped below one. Comment out the line and it works fine. Which leads me to think hv_delete() is decrementing the refcount already for me. Is this true?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Does hv_delete() decrement the reference count of the SV * it returns?
by tachyon (Chancellor) on Oct 14, 2004 at 03:00 UTC | |
by Anonymous Monk on Oct 14, 2004 at 03:14 UTC | |
by tachyon (Chancellor) on Oct 14, 2004 at 03:54 UTC |