Release allocated demo memory (property editor demo) #8158
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi !
When testing the demos, I realized there is some memory associated with the "Property Editor" demo that is never explicitely released.
More specifically, the tree of ExampleTreeNode* children.
I could see that by using this declaration in my main.cpp, that I usually keep in all my projects (seems specific to VisualStudio) :
This PR proposes to add a destructor on the demo data, to ensure all allocated memory is explicitely released and avoid leak logs when closing the application.
Since it only affects the application release it's probably not a problem though, so it's mostly some cleaning.
PS: I am not familiar with imgui internals, so don't hesitate if you want me to change some nomenclatures or move the code elsewhere !