Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release allocated demo memory (property editor demo) #8158

Closed
wants to merge 1 commit into from

Conversation

Legulysse
Copy link

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) :

// Includes :
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

// Inside main() :
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

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 !

@ocornut ocornut added the demo label Nov 18, 2024
ocornut added a commit that referenced this pull request Nov 18, 2024
@ocornut
Copy link
Owner

ocornut commented Nov 18, 2024

Thank you for reporting this.
I have pushed eb0ad66 which solves the problem in a simpler way. Thanks!

@ocornut ocornut closed this Nov 18, 2024
@Legulysse
Copy link
Author

Thank you for your work !

@Legulysse Legulysse deleted the fix-demo-memory-release branch November 19, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants