Embedded Python Memory Grows until I Run Out of Memory :(
I've added the ability to do some scripting with Embedded Python in my app. I need to pass a large dictionary of data开发者_高级运维 (around 15MB) to the python plugins from my application. For some reason, the app is using close to 60MB of memory each time I pass in 15MB dict.
I've been looking online and it seems that there is a problem with embedded python not releasing memory, i.e. memory leak. It eventually segfaults if I continue to run the plugin enough times as it runs out of main memory.
I've tried releasing the memory for the dictionary using "del myDict" at the end of my script and "gc.collect()", but this isn't helping at all. This happens in both Linux and OS X.
Each time I run a python plugin I call Py_Initialize() and Py_Finalize().
精彩评论