[Pdx-pm] I'm lost!
ewilhelm at sbcglobal.net
Mon Jan 31 09:40:00 PST 2005
# The following was supposedly scribed by
# Nick Wehr
# on Friday 28 January 2005 08:31 am:
>I'm writing an Inline::C module...and I'm getting seg faults when I
> use it. When I run it through valgrind, it tells me that there are
> memory leaks. It says it's from the memory I allocated using Newz
> from the perl API. So my question is this: am I supposed to be
> using the API functions New, Newz, and Safefree? or should I stick
> with the standard malloc and free?
Maybe a question for the Inline list (inline at perl.org). Though, I
would probably want to see your code there too. Are you using
objects with destructors or a functional interface where you rely on
You should be able to use malloc and free, as long as they don't break
on your platform/compiler (I believe that's the whole reason for
having the API functions: they have all the #ifdef mess builtin.)
As long as you're not mixing the malloc with the Safefree, you should
be okay. Your segfaults are probably coming from destroying
something that is still referenced, or not destroying it before the
end of the program.
"Matter will be damaged in direct proportion to its value."
More information about the Pdx-pm-list