|Think about Loose Coupling|
Re^2: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memoryby edan (Curate)
|on Jul 10, 2006 at 11:47 UTC||Need Help??|
Thanks for the reply demerphq. But I think you've confused me more.
I thought my mortalized SVs were only supposed to be blown away when the following code gets executed:
So how could the values be freed too soon?
Also, if what you say is true, then I'd think it would hold true for storing values in a hash, too. But I experimented, and it seems like there, I have to mortalize the SVs I am storing in the hash, or there's a leak:
That leaks, but if I mortalize the SV as in the comment, everything is great, and there are no warnings. So what gives? What's the difference between the av_push and hv_store examples?