This is about embedded python using swig.
I have an std::map<enum, std::string>
exposed to python (embedded python). When the script is executed, swig spits out the below "warning" at the end (when the map goes out of scope - I guess):
swig/python detected a memory leak of type 'std::map< MyEnum, std::string>
... no destructor found
The .i file is:
enum MyEnum {
...
};
typedef std::map<MyEnum, std::string> MyTypedef;
%template(MyTypedef) std::map<MyEnum, std::string>;
Things are ok if I replace MyEnum
with int all over the code. Don't know why swig needs any special destruction when enums are not PyObjects! Am I missing something? Is there some %magic_operator
which will help.
Note: I do not want to suppress the "memory leak" warning all together.
Took a hard look at the wrapper generated by swig but in vain.