I am using LLVM-C to program a little toy language. I am using also valgrind to check for memory leaks.
Here is my basic baby program:
#include <stdio.h>
#include <llvm-c/Core.h>
int main()
{
size_t length;
LLVMModuleRef module = LLVMModuleCreateWithName("llvm.hello");
printf("Module name: %s\n", LLVMGetModuleIdentifier(module, &length));
LLVMDisposeModule(module);
LLVMShutDown();
return 0;
}
I can compile and run the program normally, as expected. However when I run the program through valgrind, it tells me I have some "still reachable" allocated memory like this.
valgrind --leak-check=full out/hello_llvm
==5807== LEAK SUMMARY:
==5807== definitely lost: 0 bytes in 0 blocks
==5807== indirectly lost: 0 bytes in 0 blocks
==5807== possibly lost: 0 bytes in 0 blocks
==5807== still reachable: 56 bytes in 2 blocks
==5807== suppressed: 0 bytes in 0 blocks
While searching over here on this site for an answer, I found many coders are saying that "still reachable" memory leaks are not such a big deal. I don't want to argue about that. What I want is to get rid of ALL allocated memory before terminating my program.
Is there any way I can reduce that allocated memory down to zero before termination?