investigate ways to find memory leaks in the JNI code (javaHeclib.dll)
ktarbet opened this issue · comments
Karl Tarbet commented
Recently we have found some JNI memory leaks in the grid retrieval code.
on windows this code is a possibility
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
Karl Tarbet commented
I've had success finding some leaks using this in Hec_Zopen:
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);// | _CRTDBG_MODE_WNDW);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
and this in Hec_Zclose
printf("\n calling _CrtDumpMemoryLeaks\n");
int leaks = _CrtDumpMemoryLeaks();
if (leaks)
printf("\nFound Leaks..");
Mike Perryman commented
I've had good success using Microsoft's debug memory management for many years.