Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

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


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

Amended accordingly (studying the version you cite av_clear appears to have been renamed to Perl_av_clear and the new av_clear has another purpose).

-M

Free your mind


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

    Er, in the perl API all the public functions are defined as Perl_<whatever> and documented without the Perl_ prefix, they are also available without the prefix through macros defined in embed.h. This was the case equally for the 5.6 MacPerl source that you originally looked at. I pointed you at the APC repository not because there was any particular difference in that function (except for some tidying and type changes they are largely identical between the two versions,) but simply because the MacPerl source you pointed to is more than four years old and based on the 5.6 source, whereas the APC reflects the current versions of Perl.

    /J\

      Er, no and I don't want to continue this OT discussion.

      update Unfortunately it appears from the advice of a janitor I have to be clearer. A perusal of the two code versions shows clearly that 'cleanup' doesn't cover it. Nor does the commenting in the code support this hypothesis. It looks more like a wishful guess motivated by the desire not to change an earlier conclusion at all costs, this notwithstanding disinforming the OP.

      -M

      Free your mind

        Actually what gellyfish said is spot on. All Perl_ routines on certain OS'es take an explicit aTHX_ pointer as the first argument. The macro equivelents (without the Perl_ prefix) transparently handle this. So Perl_av_clear() is what av_clear() resolves to, except that the latter handles the aTHX_ pointer as needed on a arch/os dependent basis.

        Also, judging by the code av_clear() has not substantially changed since Perl has been in subversion. The version in bleadperl, is substantially unchanged, and the the Perl_ prefix was added in change #3522.

        And for the record i dont consider this to be OT at all. Im sure somebody can learn something useful from it.

        ---
        $world=~s/war/peace/g

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-07-31 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls