We have a large C++ library that I have wrapped using SWIG.


We noticed recently that memory being used by the python process slowly grows as our code runs.


We’ve isolated the behavior down to something like this.


If I create an instance of a SWIG wrapped class repeatedly in a loop, the memory used by the python process grows unbounded.


For example:


for x in range(1000):

    instance = mymodule.MyWrappedClass()


The above code will leak memory.  My expectation is that this would not change memory usage at all.


I have done a lot of googling trying to see if someone has had a similar.


I’ve seen suggestions to use %newobject, but I don’t think this applies in this scenario.


Does anyone have a suggestion on what might be wrong with my wrapper?


Thanks in advance,




      - - - - - Appended by Scientific Atlanta, a Cisco company - - - - -         
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.