Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Perl XS: garbage-collecting my malloc'd buffer

by pg (Canon)
on Mar 03, 2003 at 16:37 UTC ( [id://240068]=note: print w/replies, xml ) Need Help??


in reply to Perl XS: garbage-collecting my malloc'd buffer

Not about Perl, but for the c code, it is better to check whether tmp_buffer is NULL, after the malloc call. If it is NULL, then the malloc failed, and there is no point to continue, otherwise you would see core dumps somewhere down the road. It is also better to check whether it is a NULL pointer, before you free it.

(As this is demo, I guess you might have the checking in your real code ;-), just in case…)
  • Comment on Re: Perl XS: garbage-collecting my malloc'd buffer

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-25 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found