Discussion:
Is this a memory leak? (Math::Factor::XS)
(too old to reply)
Ben Bullock
2013-03-30 02:37:36 UTC
Permalink
I am just looking at someone else's code here:

https://github.com/benkasminbullock/Math-Factor-XS/blob/master/XS.xs#L41

From the recent discussion on this list, I get the impression that is a
memory leak of "factors". Is that a correct understanding? Should I report
this as a bug?

Also, what is the test module for XS memory leaks on objects created via
newAV, newHV?
Ben Bullock
2013-03-30 02:40:08 UTC
Permalink
Sorry, I think I overlooked this:

https://github.com/benkasminbullock/Math-Factor-XS/blob/master/XS.xs#L62

This is reducing the reference count, right? So no leak. Sorry about the
noise.
Post by Ben Bullock
https://github.com/benkasminbullock/Math-Factor-XS/blob/master/XS.xs#L41
From the recent discussion on this list, I get the impression that is a
memory leak of "factors". Is that a correct understanding? Should I report
this as a bug?
Also, what is the test module for XS memory leaks on objects created via
newAV, newHV?
bulk88
2013-03-30 04:18:04 UTC
Permalink
Post by Ben Bullock
https://github.com/benkasminbullock/Math-Factor-XS/blob/master/XS.xs#L41
From the recent discussion on this list, I get the impression that is
a memory leak of "factors". Is that a correct understanding? Should I
report this as a bug?
Also, what is the test module for XS memory leaks on objects created
via newAV, newHV?
factors is freed at
https://github.com/benkasminbullock/Math-Factor-XS/blob/master/XS.xs#L64
unless a croak/die happen, then it is leaked. It doesn't look like there
is any code that will do that tho, so I think the code looks fine. If
you want another opinion, ask on Perlmonks.

Loading...