Calle Dybedahl
2013-12-18 08:16:21 UTC
Hi.
The perlapi manpage has this to say about Safefree():
The XSUB-writer's interface to the C "free" function.
So I've been using it instead of a plain free() pretty consistently, and
everything seemed to work just fine. Until I uploaded my module to CPAN,
and it started getting tested on operating systems that I normally don't
run. In particular, OpenBSD. Where my code started dumping core. After
bringing up an OpenBSD VM and experimenting for some time, I've found
that replacing Safefree() with a plain free() makes the coredumps stop.
Obviously, I have missed something. My current hypothesis is that the
problem was that I used Safefree() on memory that wasn't allocated by
one of the corresponding [mc]alloc() wrappers, but instead returned by a
third-party library function. I haven't yet tried to dig into the perl
source code to see if this is the case, but I haven't found anything
about it in the documentation. Is there some place I've missed? Are
there other functions I should also be wary about using?
The perlapi manpage has this to say about Safefree():
The XSUB-writer's interface to the C "free" function.
So I've been using it instead of a plain free() pretty consistently, and
everything seemed to work just fine. Until I uploaded my module to CPAN,
and it started getting tested on operating systems that I normally don't
run. In particular, OpenBSD. Where my code started dumping core. After
bringing up an OpenBSD VM and experimenting for some time, I've found
that replacing Safefree() with a plain free() makes the coredumps stop.
Obviously, I have missed something. My current hypothesis is that the
problem was that I used Safefree() on memory that wasn't allocated by
one of the corresponding [mc]alloc() wrappers, but instead returned by a
third-party library function. I haven't yet tried to dig into the perl
source code to see if this is the case, but I haven't found anything
about it in the documentation. Is there some place I've missed? Are
there other functions I should also be wary about using?
--
Calle Dybedahl <***@cyberpomo.com>
http://www.livejournal.com/users/cdybedahl/
"Don't shoot now! There's good porn playing inside my head!" -- babycola
Calle Dybedahl <***@cyberpomo.com>
http://www.livejournal.com/users/cdybedahl/
"Don't shoot now! There's good porn playing inside my head!" -- babycola