-
Notifications
You must be signed in to change notification settings - Fork 51
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
nappgui may falsely report memory leaks at exit when linking with static libraries on windows #152
Comments
Hi @colugomusic, thanks for using NAppGUI. Indeed, with external libraries with static objects it is possible that Control over the CRT (
|
Maybe a compromise could be to allow the user to opt out by passing an additional compiler flag, e.g. #if defined(_MSC_VER) && _MSC_VER > 1400 && !defined(_NAPPGUI_NO_CRTDBG)
#define _WITH_CRTDBG 1
#include <crtdbg.h>
#endif That way they don't have to keep a separate fork of nappgui. Otherwise the output of _CrtDumpMemoryLeaks can add quite a lot of noise to the build output so it's a bit annoying to ignore. |
@colugomusic |
Perfect thank you! |
There is a typo in doc. The correct option is |
In
bmem_win.c
,_bmem_atexit()
is currently defined as:I have found that this will falsely report memory leaks at exit if your application is linking with a library which still has static objects hanging around at the point where nappgui emits the call to
_CrtDumpMemoryLeaks
. In my case it is theBoost.process
library. I think the order in which static objects across different linked libraries are deallocated is not well defined so nappgui should probably remove this call.The text was updated successfully, but these errors were encountered: