Apologies for poor formatting- writing this on my phone.
I am getting many false memory leaks reported when exiting my MFC (also cli) app.
On investigation, MFC AfxDiagnosticInit function is being called too early, and consequently the memory leak dump is occuring before my CWinApp destructor is being called, resulting in MANY false positive memory leaks
How can I ensure AfxDiagnosticInit is called sooner, so that my static variable destructor (e.g. CMyApp) is called before the leak dump starts?
Just a follow up: I found the real problem, it was relating to the fact that it is a mixed-mode C++/CLI application, and the CLI wasn’t allowing the CRT to shut down.
Revised question here:
Mixed-mode C++/CLI app not shutting down CLR correctly