You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently some of the garbage collection code that runs during ESMF_Finalize() or ESMC_Finalize() is commented out. An idea that came out of the discussion #269 is to introduce a run-time environment variable ESMF_RUNTIME_GARBAGE_EMPTY, which if set would activate the currently commented out parts of the garbage collection code. This would allow running codes with full garbage collection enable to:
Ensure no memory leaks are present. Something that some codes want to test for.
Easily test situations for which the full garbage collection code is causing issues.
Hello,
In my code, all the allocated ESMC objects are reported as memory leaks despite calling the ESMC destroy functions and the Finalize function at the end.
I noticed that the call to ESMC_GridDestroy calls the ESMCI::Grid::destroy(&gridp) which has signature static int destroy(Grid **grid, bool noGarbage=false); since no second argument is passed, the noGarbage flag is always false by default and inside the destroy function the delete is always skipped
// optionally delete the complete object and remove from garbage collection
if (noGarbage){
VM::rmObject(*gridArg); // remove object from garbage collection
delete (*gridArg); // completely delete the object, free heap
}
valgrind --leak-check=full ./exeMemLeak reveals the memory leaks. Let me know if I am missing something or if this is not-reproducible. If there isn't anything wrong with my setup, the fix might be to provide a way to set noGarbage=true while calling ESMCI::Grid::destroy() but I am not sure.
The text was updated successfully, but these errors were encountered:
Currently some of the garbage collection code that runs during ESMF_Finalize() or ESMC_Finalize() is commented out. An idea that came out of the discussion #269 is to introduce a run-time environment variable
ESMF_RUNTIME_GARBAGE_EMPTY
, which if set would activate the currently commented out parts of the garbage collection code. This would allow running codes with full garbage collection enable to:Discussed in https://github.com/orgs/esmf-org/discussions/269
Originally posted by AbhiHampiholi July 25, 2024
Requirements
Affiliation(s)
AirMettle, Inc
ESMF Version
8.6.0
Issue
Hello,
In my code, all the allocated ESMC objects are reported as memory leaks despite calling the ESMC destroy functions and the Finalize function at the end.
I noticed that the call to
ESMC_GridDestroy
calls theESMCI::Grid::destroy(&gridp)
which has signaturestatic int destroy(Grid **grid, bool noGarbage=false);
since no second argument is passed, the noGarbage flag is always false by default and inside the destroy function thedelete
is always skippedI've attached a reproducible example here (copied from the example @danrosen25 sent me yesterday) test_memleak.tar.gz
valgrind --leak-check=full ./exeMemLeak
reveals the memory leaks. Let me know if I am missing something or if this is not-reproducible. If there isn't anything wrong with my setup, the fix might be to provide a way to setnoGarbage=true
while callingESMCI::Grid::destroy()
but I am not sure.The text was updated successfully, but these errors were encountered: