Memory leak and DirectGui

Hello, I’ve been trying to implement a perlin noise editor (github.com/fnadalt/mundo/perlingen), using panda3d 1.10. There’s a main menu that has a button to open the tool. When I close the tool the memory seems not to be freed. As I reopen/close the tool, memory use increases (PStatsClient/SystemMemory). MemoryUsage shows GeomNodes increase. I tried to be carefull with cyclic refs, so I implemented a kind of twisted system to avoid it. I used DirectGui .destroy() method. Please take a look. Thanks

x86_64
Linux 4.11.5-1-ARCH
Panda3D 1.10.0
Python 3.6.1
perlingen.zip (339 KB)

This will sound crazy, but some experimentation shows that it has to do with the fact that you’re changing the name on the DirectEntry. If you change the name on the node, you have to explicitly store it and call destroy() when you are done with it. Otherwise, they don’t seem to leak.

Also, you need to store the DirectOptionMenu and call destroy() on it. There must be some circular reference going on with it.