Partial patch for memleaks in fromarray, is_convertible_to_mat, convert_to_CvMat (Feature #499)


Added by Daniele Paganelli over 14 years ago. Updated about 14 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:James Bowman % Done:

0%

Category:python bindings
Target version:-
Difficulty: Pull request:

Description

I tried to resolve #489 and #493. Basically there are missing Py_DECREF calls on temporary objects used only inside fromarray, is_convertible_to_mat, convert_to_CvMat functions.

This is only a "partial" resolution for the memleak problems of the cv.cpp module, made around my personal needs.
But, I found that many other functions has the same problem. The declare temporary python objects, then forgot to decref them before exiting in one of their many return points.

For example these 3 functions will cause memleaks if there is an error, because I placed the decref call only before the successful return point.


partial_memleak.patch - Resolving some of the many memleaks of cv.cpp (1.9 kB) Daniele Paganelli, 2010-07-28 09:31 am


Associated revisions

Revision 39baa223
Added by Andrey Kamaev about 12 years ago

Merge pull request #499 from vpisarev:zeroelem_fix

History

Updated by James Bowman over 14 years ago

Thanks - will apply today.

Updated by Daniele Paganelli over 14 years ago

It seems the problem is still there and the patch has not been applied.

Updated by [email protected] - over 14 years ago

Replying to [comment:3 mythsmith]:

It seems the problem is still there and the patch has not been applied.

I've found that the Py_DECREF(o) on line 1626 of your patch caused a segfault when calling cv.fromarray() on a NumPy array. Keeping the other two fixed a problem I was having with that function leaking massive amounts of memory, so thanks a million anyway.

Updated by James Bowman about 14 years ago

Was fixed in r4515 and r4556

  • Status set to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF