Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: perl +xs : crash after some time

by Anonymous Monk
on Nov 04, 2017 at 09:39 UTC ( #1202742=note: print w/replies, xml ) Need Help??


in reply to perl +xs : crash after some time

Reading perlcall, there's an example with SPAGAIN; after the call_pv().

The purpose of the macro "SPAGAIN" is to refresh the local copy of the stack pointer. This is necessary because it is possible that the memory allocated to the Perl stack has been reallocated during the call_pv call.
You do the opposite: a PUTBACK; after the call. There shouldn't be need for either as you don't access SP after the call.

Anyway, that was just my quick guess. Can you try the code without this (second) PUTBACK; statement?

Replies are listed 'Best First'.
Re^2: perl +xs : crash after some time
by frazap (Beadle) on Nov 06, 2017 at 14:07 UTC
    Yes, You're right !

    reading again perlcall, passing one parameter here there's no call to PUTBACK after call_pv.

    Without this second PUTBACK, I was not able to crash my code with a few minutes testing

    Thanks a lot !

    François

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1202742]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-06-22 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (120 votes). Check out past polls.

    Notices?