how can I decrease the reference count of $hash?Why?
Of course $retval has a refcount of 1, so it is correctly free'd but $hash is not because it has a refcount of 2.Yes. At least if you're decrementing the refcount on $retval. Decrementing the refcount of $hash will result in all kinds of mahem.
This is a simplified example of course, the 3rd party module I am using gives me a hash reference that probably has circular references in it which is why it doesn't get garbage collected properly.
Circular references wreak havoc on perl's GC, and have to be broken up before releasing. That's a well known issue, and I'd bet a case of good beer on it not being fixed ever in perl versions < 6 (and perl6 will change a lot of scope semantics anyway).
None of this has anything to do with the code you posted. In other words: what are you talking about?
In reply to Re: reduce reference count of hash
by Joost
in thread reduce reference count of hash
by perlseeker5
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |