Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory

by Moron (Curate)
on Jul 10, 2006 at 09:07 UTC ( #560099=note: print w/ replies, xml ) Need Help??


in reply to perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory

From my point of view, there is a lot of missing macro and/or typedef and C subroutine code. In particular, without seeing the typedef/macro code behind the LHS AV *arr and the code for the subroutine newAV, I find it impossible to construct reliably what is being handed down to Perl.

-M

Free your mind


Comment on Re: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory
Re^2: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory
by gellyfish (Monsignor) on Jul 10, 2006 at 09:23 UTC

    You will find these things in the perl source code. newAV() is defined in av.c. The struct av is defined in sv.h and the typedef struct av AV; is in perl.h

    /J\

      I have now found a copy of the source of av.c at sourceforge updated version and my first second impression is that an explicit call to av_clear Perl_av_clear is required to free the memory.

      -M

      Free your mind

        You probably actually wanted a more recent copy of the source. av_clear doesn't free the memory allocated to the array nor does it free the SVs that form its elements. It simply truncates the array.

        /J\

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-10-25 22:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls