It is not clear why we didn't hit this before, but in some cases we
see calloc being optimized away (just like we had with
new/malloc). And noopt is how we deal with it.
Previous implementation used GetEnvironmentVariableA which appears to
be calling into Heap{Alloc,Free}, so in some cases may recurse into
tcmalloc. So we use 'wide' character version and perform trivial
conversion to/from 7-bit ASCII.
In 57d6ecc4ae I removed obsolete
src/windows/TODO but failed to remove it from Makefile.am
I also previously failed to arrange distribution of vendored
googletest. And we also failed to distribute headers in src/tests/
This is all fixed now.
In file included from /home/louwei/arcs/gperftools/src/span.cc:41:0:
/home/louwei/arcs/gperftools/src/static_vars.h:125:37: error: ‘byte’ in namespace ‘std’ does not name a type
alignas(alignof(PageHeap)) std::byte memory[sizeof(PageHeap)];
^~~~
/home/louwei/arcs/gperftools/src/static_vars.h: In static member function ‘static tcmalloc::PageHeap* tcmalloc::Static::pageheap()’:
/home/louwei/arcs/gperftools/src/static_vars.h:76:80: error: ‘struct tcmalloc::Static::<unnamed>’ has no member named ‘memory’
static PageHeap* pageheap() { return reinterpret_cast<PageHeap *>(&pageheap_.memory); }
^~~~~~
The test includes override of
MallocHook_InitAtFirstAllocation_HeapLeakChecker which runs early
enough to trigger FreeBSD bug of not having nearly anything working
early.
Turns out at least on FreeBSD tmpfile will fail if TMPDIR points to
non-existant directory. This also has nice property of leaving it down
to users to set up TMPDIR the way they want.
There were far too many intermediate libraries, references to obsolete
libtool bugs and whatnot.
We now have libcommon.la as a convenience archive that contains
spinlock, logging and misc stuff. A number of unit tests that need
those facilities are being linked to this.
Then we have libstacktrace.la convenience archive, since it is used by
libtcmalloc.la and libprofiler.la.
And after that we're simply directly creating our main library
products: libtcmalloc_minimal{,_debug}.la, libtcmalloc_{,debug}.la,
libprofiler.la etc.
We now wrap StackTraceScope thingy in tcmalloc-specific parts, instead
of automagically inside every stacktrace.cc function. TCMalloc bits
all need to grab stacktraces via newly introduced
tcmalloc::GrabBacktrace (which handles emergency malloc wrapping).
New approach eliminates the need for doing fake stacktrace scope. CPU
profiler, being distinct .so library couldn't take advantage of
emergency malloc anyways.
This simplifies the build further and eliminates another potential
point of runtime divergence when stacktrace is linked to both
libprofiler and libtcmalloc.
For compiling things automake never needs to be given a full set of
headers. Usually headers are specified so that make dist includes them
into archive, but we can achieve this goal easier.
This reduces size and complexity of our Makefile.am stuff.
We had hardcoded size alignment on 64 bytes, seemingly to avoid
cacheline contention when taking per-size-class central free list
locks. But it makes more sense to do platform specific alignment.
I did consider std::hardware_constructive_interference_size, but
practical values seem to differ from what we have configured at least
on some platforms.