title: What all C operations does valgrind treat as 'malloc' and 'free'?
body: <p>At work I'm writing a rather complex piece of software in C, and I frequently test it using valgrind.  The program so far works perfectly with no memory leaks or array-bounds violations, and in the valgrind report, the number of 'frees' matched the number of 'mallocs' - great.  The thing that bugs me is that it reports thousands of frees and mallocs.  And I know for a fact I'm not doing more than about 50-60.  I do know that when my program calls 'fopen', that call is counted by valgrind toward the number of mallocs, and similarly 'fclose' is counted toward the number of 'frees'.  But in my case, this still doesn't explain the numbers I'm seeing for how many times memory is being malloced and freed.  I've scoured my code carefully looking for the culprit, but I got nothing.  I can't post any code here for obvious reasons, but I just want to know, am I missing something?  Are there other C operations that valgrind counts toward the number of mallocs and frees?</p>
  
  <p>Here's my valgrind report.  As you can see, everything looks good from this perspective.</p>
  
  <pre><code>Memcheck, a memory error detector
  Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
  Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
  Command: ./Codec
  Parent PID: 3526
  
  HEAP SUMMARY:
       in use at exit: 0 bytes in 0 blocks
     total heap usage: 2,407 allocs, 2,407 frees, 28,877,748 bytes allocated
  
   All heap blocks were freed -- no leaks are possible
  
   For counts of detected and suppressed errors, rerun with: -v
   ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
  </code></pre>