I recently learned about the memory error checking tool, Valgrind. I checked for allocs on some very simple C++ code and found some interesting results which is very weird. For eg.,
#include<iostream>
using namespace std;
int main(){
return 0;
}
And the valgrind ouput is:
$ valgrind ./a.out
==16952== Memcheck, a memory error detector
==16952== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==16952== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==16952== Command: ./a.out
==16952==
==16952==
==16952== HEAP SUMMARY:
==16952== in use at exit: 72,704 bytes in 1 blocks
==16952== total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated
==16952==
==16952== LEAK SUMMARY:
==16952== definitely lost: 0 bytes in 0 blocks
==16952== indirectly lost: 0 bytes in 0 blocks
==16952== possibly lost: 0 bytes in 0 blocks
==16952== still reachable: 72,704 bytes in 1 blocks
==16952== suppressed: 0 bytes in 0 blocks
==16952== Rerun with --leak-check=full to see details of leaked memory
==16952==
==16952== For counts of detected and suppressed errors, rerun with: -v
==16952== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Anybody please explain the mysterious alloc on this line:
==16952== total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated