Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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 ( #560158=note: print w/ replies, xml ) Need Help??


in reply to Re^5: 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

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\


Comment on Re^6: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory
Download Code
Re^7: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory
by Moron (Curate) on Jul 11, 2006 at 08:50 UTC
    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

        It was gellyfish who claimed that the change had taken place. "Somebody might find it useful?". Somebody might find a leotard useful but that would hardly make it germane to this discussion. The comments for Perl_av_clear clearly state that this function releases the memory which it what the OP wants to know about and nothing else.

        -M

        Free your mind

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-12-20 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls