Hook up tcmalloc

Change-Id: I11c8dd2a2bd67f54bdce3ca6eb5bc97d02c9fae9
diff --git a/third_party/gperftools/src/base/sysinfo.cc b/third_party/gperftools/src/base/sysinfo.cc
index cad751b..8183494 100644
--- a/third_party/gperftools/src/base/sysinfo.cc
+++ b/third_party/gperftools/src/base/sysinfo.cc
@@ -160,7 +160,7 @@
   const char* p = envbuf;
   while (*p != '\0') {    // will happen at the \0\0 that terminates the buffer
     // proc file has the format NAME=value\0NAME=value\0NAME=value\0...
-    const char* endp = (char*)memchr(p, '\0', sizeof(envbuf) - (p - envbuf));
+    const char* endp = (const char*)memchr(p, '\0', sizeof(envbuf) - (p - envbuf));
     if (endp == NULL)            // this entry isn't NUL terminated
       return NULL;
     else if (!memcmp(p, name, namelen) && p[namelen] == '=')    // it's a match
diff --git a/third_party/gperftools/src/base/thread_lister.c b/third_party/gperftools/src/base/thread_lister.c
index ca1b2de..e837c3e 100644
--- a/third_party/gperftools/src/base/thread_lister.c
+++ b/third_party/gperftools/src/base/thread_lister.c
@@ -36,6 +36,9 @@
 #ifdef HAVE_SYS_PRCTL
 # include <sys/prctl.h>
 #endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include "base/thread_lister.h"
 #include "base/linuxthreads.h"
 /* Include other thread listers here that define THREADS macro