Commit Graph

30 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka f2f301df7a gitignore build/
This is a common directory used by out-of-tree cmake builds.
2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka b81d639793 ignore googletest .dirstamp 2024-02-22 17:54:01 -05:00
Aliaksey Kandratsenka f8da159013 add function_ref_test 2024-02-21 21:57:37 -05:00
Aliaksey Kandratsenka bfbfa333eb add cleanup_test
This also let us spot and fix missing include in the header.
2024-02-21 21:37:47 -05:00
Aliaksey Kandratsenka c1799405ae gtestify check_address_test 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka 6c24a59682 introduce vendor copy of googletest 2024-02-20 14:30:24 -05:00
Aliaksey Kandratsenka cad457ad23 actualize .gitignore 2024-02-07 20:30:53 -05:00
Aliaksey Kandratsenka c52c321bdd replace raw printer with usage of generic writer facility 2024-02-07 15:46:54 -05:00
Aliaksey Kandratsenka 1331c0e0d1 drop long deprecated google/ headers 2024-02-04 21:54:46 -05:00
Aliaksey Kandratsenka a3080fa8d6 extract proc-maps iteration into own file and cover it by tests
This allows us, later, to avoid building this stuff in configurations
that don't use it. I have also reduced API and ABI surface to enable
further refactorings.
2024-01-29 21:02:17 -05:00
Aliaksey Kandratsenka 24774ebb38 introduce generic_writer facility 2024-01-24 17:30:18 -05:00
Aliaksey Kandratsenka 2748dd5680 unbreak address access "probing" for generic_fp backtracing
We used msync to verify that address is readable. But msync gives
false positives for PROT_NONE mappings. And we recently got bug report
from user hitting this exact condition.

For correct access check, we steal idea from Abseil and do sigprocmask
with address used as new signal mask and with invalid HOW
argument. This works in today's Linux kernels and is among fastest
methods available. But is brittle w.r.t. possible kernel changes. So
we supply fallback method that does 2 syscalls.

For non-Linux systems we implement usual "write to pipe" trick. Which
also has decent performance, but requires occasional pipe draining and
uses fds which could occasionally be damaged by some forking codes.

We also finally cover all new code with unit test.

Fixes github issue #1426
2023-09-10 17:24:32 -04:00
Ivan Dlugos 7ad1dc7693 fix: cmake config.h defines declaration 2023-09-08 14:38:21 -04:00
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