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 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,