google / fleetbench

Benchmarking suite for Google workloads
Apache License 2.0
116 stars 10 forks source link

Upgrade tcmalloc #23

Closed pcc closed 6 months ago

pcc commented 7 months ago

In my local builds with libc++ and an up-to-date clang I was seeing an unused variable error from tcmalloc. I worked around it with the patch below.

--- tcmalloc/system-alloc.cc.orig       2024-04-11 19:05:57.249351705 -0700
+++ tcmalloc/system-alloc.cc    2024-04-11 19:05:58.672340539 -0700
@@ -652,10 +652,9 @@
           strerror(errno));
       return nullptr;
     }
-    if (int err = munmap(result, size)) {
+    if (munmap(result, size)) {
       Log(kLogWithStack, __FILE__, __LINE__, "munmap() failed (error)",
           strerror(errno));
-      ASSERT(err == 0);
     }
     next_addr = RandomMmapHint(size, alignment, tag);
   }

This seems to have been fixed in upstream tcmalloc by changing the macro used for assertions to always evaluate its argument, so it looks like upgrading tcmalloc will make this problem go away.

rjogrady commented 6 months ago

Thanks for the report!