in reply to Re: Embedded Perl - Memory leak
in thread Embedded Perl - Memory leak

Actually, I have tried making 'value' a mortal. If I do that, I will have to change:
sv_free(av_delete(array, len, FALSE));
to
av_delete(array, len, FALSE);
otherwise, I get the error 'Attempt to free unreferenced scalar' on FREETMPS call. What this implies is that av_push does not increment the reference count of 'value'. Correct me if I am wrong.

Replies are listed 'Best First'.
Re: Re: Re: Embedded Perl - Memory leak
by IlyaM (Parson) on Oct 16, 2003 at 11:58 UTC
    It was long time when I wrote Perl modules in C last time but IIRC av_push does increment the reference count. On the other hand I'm not sure why you need sv_free - av_delete should decrease reference counter of deleted SV itself. Try to add sv_dump() calls to check it yourself.

    --
    Ilya Martynov, ilya@iponweb.net
    CTO IPonWEB (UK) Ltd
    Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
    Personal website - http://martynov.org