code cleanup
added optional support for tcmalloc (google-perftools)