EEGP-AAE icon indicating copy to clipboard operation
EEGP-AAE copied to clipboard

Memory Leak with the Phong Renderer from PySixd

Open Arka161 opened this issue 2 years ago • 1 comments

Hello there,

I have noticed that there's a major memory leak in the repository when we use the Phong renderer, and try to render multiple images (eg: On datasets such as T-LESS PBR, referenced in the BOP Challenge and Cosypose).

Steps to repro:

  • Just run a for loop over a few epochs and try to get the rgb and depth using the Phong renderer for a loaded Mesh + Image configuration.
  • The memory would gradually be increased till it crashes the RAM.

Let me know if you need any further details or code snippets related to the bug.

Arka161 avatar Mar 24 '22 06:03 Arka161

Just to clarify, this error doesn't hit normally, as the error seems to be on the GL/C++ end of PySixd.

The reasons generate_batches directly won't cause the bug, is because Python clears the memory when the program exits. But if in the same code you call render_phong multiple times in a loop (it is useful when you try to load up a custom dataset), the memory leak is very stark.

Are there are reference repos where I can mention this to the PySixd Devs? I also realized that the fix isn't super trivial as calling a gc() wouldn't work as the leak is associated with C++ objects.

Thank you so much

Arka161 avatar Mar 25 '22 05:03 Arka161