title: tcmalloc: how can I get my malloc calls overridden when compiling statically?
body: <p>When I use <code>LD_PRELOAD=/usr/local/lib/libtcmalloc.so</code>, all my calls to malloc become tcmalloc calls.  However, when I link statically against libtcmalloc, I find that straight malloc is getting called unless I still use the <code>LD_PRELOAD</code> setting.</p>
  
  <p>So how can I statically compile against tcmalloc in such a way that my mallocs hook into tcmalloc?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>I'm using lots of C++ new etc, so
  just #defining malloc to tcmalloc
  won't work</li>
  <li>Possibly I have to use
  malloc_hook myself, but I would have
  thought I could get tcmalloc to do it
  for me, since it clearly is doing it
  when linking dynamically</li>
  </ul>