Re: mem leak
[email protected] (Torsten Schoenfeld)
| Newsgroups | perl.xs |
|---|---|
| Message-ID | <[email protected]> |
On 19.07.2010 12:52, ravips wrote: > 1. Should a "CLEANUP" tag be added which cleans up the array > ( av_clear; av_undef;)? No, you return the AV to the caller who then assumes ownership, so you mustn't free it. I think you should even be able to get rid of the sv_2mortal call since the AV* typemap should do this for you. > 2. Is the way hv is handled in the loop appropriate? Will it get > cleaned up appropriately? No. You need to use newRV_noinc instead of newRV when you push a reference to the HV into the AV.