Closed LincolnSand closed 2 years ago
FYI, this reference cycle issue is now fixed in on master
. For details, see https://github.com/mitsuba-renderer/nanogui/commit/77b8d98a90223d6e0eb72188a619fbb153ef6c47 and https://github.com/mitsuba-renderer/nanogui/commit/e3dcfc51a9473d71e8cfb4e7f3020c6219051e03.
I decided to stick logging into the ref counting and Object destruction. I also decided to put in a destructor for
ExampleApplication
. It properly hits a ref count of 0 and calls the destructor ifRenderPass
andImageView
are not used (ImageView
internally usesRenderPass
). If they are used, it fails to ever hit a ref count of 0 and "leaks" memory on program exit and never calls theExampleApplication
destructor. I tracked it back to astd::vector
inRenderPass
calledm_targets
that appears to be the reason that it holds these owning references on program exit. It appears thisstd::vector
ofref<Object>
's is never cleared (hence destructing the elements) and so these owning references continue to persist.I have not found a fix to this bug so far.
If this is intentional behavior, then it is unclear from the documentation and confusing from a user pov.
Hopefully this bug report is detailed enough. I can post exact reproducibility code if needed after some time (I'm quite busy).