I have a C++ dll used for a JNI Java project.
I added:
1 2 3 4 5 6
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
// This at end of dll execution (in the destructor of main class)
_CrtDumpMemoryLeaks();
Before _CrtDumpMemoryLeaks(); is called I purposely create memory leaks:
1 2 3 4 5 6 7
char *string;
string = newchar[20];
for (int i = 0; i != 5; ++i) {
new OCRManager();
std::cout << "Leak Created" << std::endl;
}
I run my Java app that makes native calls to the DLL and when it finished executing I do not get the leak report.
Am I missing something? Can I even get the report when calling the dll from Java?
Is there another way to run the dll so I can see the leaks?