Commit Graph

17 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
51c5e2bec7 massage latest GetUniquePathFromEnv changes
This fixes a number of minor bits (like build details) as well as
making overall code style similar to what we're doing elsewhere.
2023-08-09 16:29:13 -04:00
Aliaksey Kandratsenka
8be84e4a5c drop old mmap hooks and introduce internal & simpler mmap_hook.h
Previous implementation wasn't entirely safe w.r.t. 32-bit off_t
systems. Specifically around mmap replacement hook. Also, API was a
lot more general and broad than we actually need.

Sadly, old mmap hooks API was shipped with our public headers. But
thankfully it appears to be unused externally (checked via github
search). So we keep this old API and ABI for the sake of formal API
and ABI compatibility. But this old API is now empty and always
fails (some OS/hardware combinations didn't have functional
implementations of those hooks anyways).

New API is 64-bit clean and only provides us with what we need. Namely
being able to react to virtual address space mapping changes for
logging, heap profiling and heap leak checker. I.e. no pre hooks or
mmap-replacement hooks. We also explicitly not ship this API
externally to give us freedom to change it.

New code is also hopefully tidier and slightly more portable. At least
there are fewer arch-specific ifdef-s.

Another somewhat notable change is, since mmap hook isn't needed in
"minimal" configuration, we now don't override system's
mmap/munmap/etc functions in this configuration. No big deal, but it
reduces risk of damage if we somehow mess those up. I.e. musl's mmap
does few things that our mmap replacement doesn't, such as very fancy
vm_lock thingy. Which doesn't look critical, but is good thing for us
not to interfere with when not necessary.

Fixes issue #1406 and issue #1407. Lets also mention issue #1010 which
is somewhat relevant.
2023-07-21 16:13:19 -04:00
Aliaksey Kandratsenka
d4f3362035 add missing .gitignore for safe_strerror_test.exe 2023-07-21 14:32:37 -04:00
Aliaksey Kandratsenka
46d3315ad7 amputate maybe_threads
This facility allowed us to build tcmalloc without linking in actual
-lpthread. Via weak symbols we checked at runtime if pthread functions
are available and if not, special single-threaded stubs were used
instead. Not always brining in pthread dependency helped performance
of some programs or libraries which depended at runtime on whether
threads are linked or not. Most notable of those are libstdc++ which
uses non-atomic refcounting on single threaded programs.

But such optional dependency on pthreads caused complications for
nearly no benefit. One trouble was reported in github issue #1110.

This days glibc/libstdc++ combo actually depends on
sys/single_threaded.h facility. So bringing pthread at runtime is
fine. Also modern glibc ships pthread symbols inside libc anyways and
libpthread is empty. I also found that for whatever reason on BSDs and
osx we already pulled in proper pthreads too.

So we loose nothing and we get issue #1110 fixed. And we simplify
everything.
2023-07-14 03:07:16 -04:00
Aliaksey Kandratsenka
f15425dc99 implement SafeStrError and use it inside strerror
This fixes issue #1371

From time to time things file inside tcmalloc guts where calling to
malloc is not safe. Regular strerror does locale bits, so will
occasionally open files/malloc/etc. We avoid this by using our own
"safe" variant that hardcodes names of all POSIX errno constants.
2023-07-03 18:14:05 -04:00
Aliaksey Kandratsenka
e5ac219780 restore unwind-bench
We previously deleted it, since it wasn't portable enough. But
unportable bits are now ifdef-ed out, so we can return it.
2023-07-02 22:30:00 -04:00
Aliaksey Kandratsenka
54605b8a58 amputate old atomic ops implementation 2023-07-02 22:30:00 -04:00
Aliaksey Kandratsenka
c939dd5531 correctly check sized delete hint when asserts are on
We previously tested wrong assumption that larger than page size size
classes have addresses aligned on page size. New code is making proper
check of size class.

Also added is unit test coverage for this previously failing
condition. And we now also run "assert-ful" unittests for big tcmalloc
too, not only tcmalloc_minimal configuration.

This fixes github issue #1254
2021-02-28 15:54:22 -08:00
Aliaksey Kandratsenka
5eec9d0ae3 Drop not very portable and not very useful unwind benchmark. 2018-10-07 08:17:04 -07:00
Aliaksey Kandratsenka
954f9dc0e3 Add flag to disable installing unmaintained & deprecated pprof.
Everyone should be using golang pprof from github.com/google/pprof, but
distros still ship our perl version and not everyone is aware of
better pprof yet.

This is another step in completely dropping perl pprof. We still
default to installing it, but hopefully we'll be able to convince
distros to disable this soon.

We still install pprof under pprof-symbolize name because
stack traces symbolization depends on it, and because golang pprof
won't support this feature.

This is related to issue #1038.
2018-08-26 11:37:59 -07:00
Aliaksey Kandratsenka
5ac82ec5b9 added stacktrace capturing benchmark 2017-05-29 14:57:13 -07:00
Aliaksey Kandratsenka
5c778701d9 added tcmalloc minimal unittest with ASSERTs checked 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
32d9926795 added malloc_bench_shared_full 2016-02-06 19:14:23 -08:00
Aliaksey Kandratsenka
0fb6dd8aa3 added binary_trees benchmark 2015-11-21 18:17:21 -08:00
Aliaksey Kandratsenka
64e0133901 added trivial malloc fast-path benchmark
While this is not good representation of real-world production malloc
behavior, it is representative of length (instruction-wise and well as
cycle-wise) of fast-path. So this is better than nothing.
2015-08-02 16:53:19 -07:00
Aliaksey Kandratsenka
4ace8dbbe2 added subdir-objects automake options
This is suggested by automake itself regarding future-compat.
2014-12-21 18:49:47 -08:00
Aliaksey Kandratsenka
89b163a088 added .gitignore 2013-08-04 18:27:07 +03:00