Closed behrisch closed 4 months ago
SWIG_POINTER_OWN
means the object created by make_output_iterator()
should be cleaned up by Python's garbage collection.
Static analysis tools can to be a bit trigger happy about suggesting there are memory leaks - can you demonstrate there's actually a leak here (e.g. by wrapping an object of a class which counts calls to its constructor and destructor)?
Thanks for your help, I decided to ignore those warnings
This is another one from static code analysis like #2865 but with Python this time.
The SWIG code looks like this (removed a few lines for clarity):
I admit I don't understand everything about the encapsulated iterator but at least it looks like a pointer is being returned and to me it is not clear who is taking the responsibility of cleaning it up. I could also not find the DECREF the python C API uses to get rid of objects. So is this a legitimate memory leak?
The input to reproduce this is probably very simple:
The full report can be found here:
https://sonarcloud.io/project/issues?impactSoftwareQualities=RELIABILITY&issueStatuses=OPEN%2CCONFIRMED&id=org.eclipse.sumo&open=AZLBiQCj6jzsRIZ_s-l4
I am using swig 4.2.0 on ubuntu 24.04.