Bug #1337

The SWIG interface seems to have trouble with objects returned by value

Added by Knödlseder Jürgen over 9 years ago. Updated over 9 years ago.

Status:NewStart date:10/15/2014
Priority:NormalDue date:
Assigned To:-% Done:

0%

Category:-
Target version:-
Duration:

Description

See #1335 for a description of the issue.


Recurrence

No recurrence.


Related issues

Related to ctools - Feature #1335: Write csresmap Closed 10/13/2014

History

#1 Updated by Knödlseder Jürgen over 9 years ago

Concerning the memory leak, see the SWIG documentation: http://www.swig.org/Doc2.0/SWIG.html#SWIG_nn23

C functions that return structures or classes datatypes by value are more difficult to handle. [...] SWIG allocates a new object and returns a reference to it. It is up to the user to delete the returned object when it is no longer in use. Clearly, this will leak memory if you are unaware of the implicit memory allocation and don’t take steps to free the result. That said, it should be noted that some language modules can now automatically track newly created objects and reclaim memory for you.

So the question is whether something can be added to allow tracking of the memory allocation in Python.

Also available in: Atom PDF