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

investigate ways to find memory leaks in the JNI code (javaHeclib.dll) #148

Open
ktarbet opened this issue Oct 6, 2022 · 2 comments
Open
Assignees

Comments

@ktarbet
Copy link
Contributor

ktarbet commented Oct 6, 2022

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>
@ktarbet
Copy link
Contributor Author

ktarbet commented Oct 7, 2022

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..");

ref: https://learn.microsoft.com/en-us/visualstudio/debugger/finding-memory-leaks-using-the-crt-library?view=vs-2022

@ktarbet ktarbet self-assigned this Oct 7, 2022
@perrymanmd
Copy link
Contributor

I've had good success using Microsoft's debug memory management for many years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants