I'm a beginner in C, and I'm wondering why this simple Hello World program has a memory leak:
#include <stdio.h>
int main(int argc, const char *argv[]) {
printf("Hello world\n");
return 0;
}
It compiles, but this is what Valgrind reports:
> valgrind ./a.out
==36468== Memcheck, a memory error detector
==36468== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==36468== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==36468== Command: ./a.out
==36468==
Hello world
==36468==
==36468== HEAP SUMMARY:
==36468== in use at exit: 26,207 bytes in 190 blocks
==36468== total heap usage: 264 allocs, 74 frees, 32,175 bytes allocated
==36468==
==36468== LEAK SUMMARY:
==36468== definitely lost: 0 bytes in 0 blocks
==36468== indirectly lost: 0 bytes in 0 blocks
==36468== possibly lost: 2,064 bytes in 1 blocks
==36468== still reachable: 0 bytes in 0 blocks
==36468== suppressed: 24,143 bytes in 189 blocks
==36468== Rerun with --leak-check=full to see details of leaked memory
==36468==
==36468== For counts of detected and suppressed errors, rerun with: -v
==36468== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
What's with the "possibly lost: 2,064 bytes in 1 blocks" and "suppressed: 24,143 bytes in 189 blocks"? I never used malloc so I'm not sure why this is happening.