Commit Graph

112 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka 38d741710b drop unused pwd.h/grp.h checks 2024-03-24 16:59:58 -04:00
Aliaksey Kandratsenka e867bb7818 amputate unused Elf32_Versym check 2024-03-24 16:59:57 -04:00
Aliaksey Kandratsenka fc496c87c4 liberate our tests from makefile setting TCMALLOC_SAMPLE_PARAMETER 2024-03-20 16:06:59 -04:00
Aliaksey Kandratsenka 8cb41da4f9 gtestify debugallocation_test
As part of that we eliminate use of shell script and rely on gtest's
death testing facility instead (which this test was originally using).
2024-03-20 16:06:48 -04:00
Aliaksey Kandratsenka 14598dd4ac gtestify and refactor tcmalloc_unittest
While it still needs more work to be up to highest standards of
cleanness and clarity, we made it better.

One big part of this change is we're now liberated from
tcmalloc_unittest.sh. We now arrange testing of various environment
variable tweaks in C++ by self-execing with updated environment at the
end of tests.
2024-03-20 16:05:14 -04:00
Aliaksey Kandratsenka 93380fc754 drop dependency on sys/resource.h
Biggest part of it is removal of SetTestResourceLimit. The reasoning
behind it is, we don't do it on windows. Tests pass just fine. So,
there is no reason to bother.
2024-03-20 16:05:06 -04:00
Aliaksey Kandratsenka a4fe2d7cd0 liberate sampling test from use of shell script
As part of that we do somewhat tighter job with temp files.
2024-03-20 16:04:52 -04:00
Aliaksey Kandratsenka 6b53b1a4c1 gtestify and cleanup system-alloc_unittest 2024-03-20 16:04:45 -04:00
Aliaksey Kandratsenka f7c8b45dcd gtestify realloc_unittest 2024-03-20 16:04:41 -04:00
Aliaksey Kandratsenka 0dddc476b3 gtestify malloc_extension_c_test 2024-03-20 16:04:39 -04:00
Aliaksey Kandratsenka 3cda0c4185 gtestify malloc_extension_test 2024-03-20 16:04:37 -04:00
Aliaksey Kandratsenka 159c9e5c53 clean up and gtest-ify large_heap_fragmentation_unittest 2024-03-20 16:04:28 -04:00
Aliaksey Kandratsenka 3b12487a83 gtestify memalign_unittest 2024-02-27 17:00:42 -05:00
Aliaksey Kandratsenka 9dfab2cdce cmake: refactor CMakeLists.txt
It is still somewhat broken and somewhat of a mess, but it is much
lesser mess now.

As part of this change I also amputated a number of unnecessary or too
complicated bits. Like attempt to build both static and shared
versions of tcmalloc libraries at the same time. We stick to cmake's
"common" (seemingly) behavior of defaulting to something (in our case
shared library) and letting users override BUILD_SHARED_LIBS.

All the "install" bits are amputated as well, they're not ready.
2024-02-27 17:00:35 -05:00
Aliaksey Kandratsenka 2940450c7a gtestify profiledata_unittest 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka bbae941492 gtestify profile-handler_unittest 2024-02-27 16:50:07 -05:00
Aliaksey Kandratsenka a4d9540d8b unbreak cmake for packed-cache_test 2024-02-27 16:50:07 -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 0906dacc48 gtestify more tests
Those are malloc_hook_test, mmap_hook_test, page_heap_test,
sampler_test, stack_trace_table_test.
2024-02-20 14:34:28 -05:00
Aliaksey Kandratsenka bfa30bf7df gtestify 3 simpler tests
Those are packed-cache_test, pagemap_unittest, safe_strerror_test
2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka ff2dce5e67 gtestify addressmap_unittest 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka c1799405ae gtestify check_address_test 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka a46a391b14 gtestify low_level_alloc_unittest 2024-02-20 14:34:20 -05:00
Aliaksey Kandratsenka 6c24a59682 introduce vendor copy of googletest 2024-02-20 14:30:24 -05:00
Aliaksey Kandratsenka c52c321bdd replace raw printer with usage of generic writer facility 2024-02-07 15:46:54 -05:00
Aliaksey Kandratsenka 771a01ed28 rework and simplify emergency malloc integration
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.
2024-02-05 14:27:02 -05:00
Aliaksey Kandratsenka 1331c0e0d1 drop long deprecated google/ headers 2024-02-04 21:54:46 -05:00
Aliaksey Kandratsenka 2e5ecb4de6 amputate src/base/simple_mutex.h
Use standard mutex instead
2024-02-04 16:38:21 -05:00
Aliaksey Kandratsenka 6691226953 split and rewrite TLS access for thread caches
Logic was removed from thread_cache.{h,cc} into
thread_cache_ptr.{h,cc}.

Separation will help possible future evolution, and we already changed
the logic quite a bit:

* early access (when TLS isn't initialized yet) now uses global
ThreadCache instance. We therefore have ThreadCachePtr instances
managing required locking. This eliminates unnecessary complication of
PTHREADS_CRASHES_IF_RUN_TOO_EARLY logic, and any other danger of
touching TLS too early. BTW previous implementation actually leaked
initial early-initialized ThreadCache instance(!)

* old configure-time HAVE_TLS logic is amputated. Config-time part of
it made little sense as C++ 17 guarantees availability of
thread_local, but we have manually curated deny-list of "bad" OSes,
that we tested (via compile checks!) at configure time. Now this
is all compile time. There is now compile-time kHaveGoodTLS variable
and we're using it mostly via if constexpr.

* kHaveGoodTLS case of creating thread cache is simplified and made
more straightforward (no need to have in_setspecific logic).

* !kHaveGoodTLS case if fixed and improved too. We avoid
std:🧵:get_id, as it deadlocks on mingw. We use errno address as
a portable and (usually) async-signal safe 'my thread' identifier. We
also eliminate linear searching of thread's cache and replace it with
straightforward hash table lookup.
2024-02-03 15:57:14 -05:00
Aliaksey Kandratsenka 51d3340b39 avoid -Wunused-results warnings from read/write
glibc with _FORTIFY_SOURCE sets those up to give warnings on unused
results. We used to disable this warning globally, but lets do better.
2024-01-30 17:08:29 -05:00
Aliaksey Kandratsenka 82a36a6fcd bump required c++ standard to c++-17 2024-01-30 15:54:24 -05:00
Aliaksey Kandratsenka 5db2adc4e7 drop stale workaround for ancient solaris issue 2024-01-29 21:02:17 -05:00
Aliaksey Kandratsenka 5ce342e1c8 fix generic_writer_test and proc_maps_iterator_test on cmake+msvc 2024-01-29 21:02:17 -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
lennoxho 9a6848de8a A number of cleanups
* Remove build dependency on HAVE_PTHREAD
* Remove build dependency on HAVE_STD_ALIGNED_VAL_T and ENABLE_ALIGNED_NEW_DELETE
* Remove redundant tcmalloc.h files & ensure there are no cross-build-tool references
* Adopt automake commit 26927d1 in the CMake build
2024-01-29 17:15:53 -08:00
lennoxho 96f34120fe Several build fixes and cleanups
- Fix CMake builds for MinGW and MSVC
- Ensure the Autotools, CMake and VSProj builds do not reference each others' config.h
- Use std:🧵:id instead of our own thread ID wrappers
- Moved explicit TLS wrapper functions into the tcmalloc:: namespace and change their visibility to hidden
Resolves #1486
2024-01-26 16:56:17 -05:00
Aliaksey Kandratsenka 79b6ad2ab5 amputate HAVE_FORK checking
Pretty much everything has fork, except windows. Which is much simpler
to test at compile time, then duplicating and complicating the test at
configure time.
2024-01-25 16:10:30 -05:00
lennoxho 5cab8f3f77 Convert MinGW builds to always use WinAPI based threading facilities. See ##1483 2024-01-24 21:47:06 -05:00
Aliaksey Kandratsenka 24774ebb38 introduce generic_writer facility 2024-01-24 17:30:18 -05:00
Aliaksey Kandratsenka 365060c421 bump version to 2.15 2024-01-05 12:23:30 -05:00
Aliaksey Kandratsenka d5c1edf4f5 [cmake] explicitly link more libraries for threading
See discussion on https://github.com/gperftools/gperftools/pull/1473
2024-01-03 16:07:16 -05:00
Aliaksey Kandratsenka e49b36f7d6 bump version to 2.14 2023-12-31 23:17:03 -05:00
Mateusz Jakub Fila bbc03edc4d added missing aggressive decommit option in cmake 2023-12-27 01:58:46 +01:00
Mateusz Jakub Fila 9c2028ae50 added missing large alloc report option in cmake 2023-12-27 01:58:34 +01:00
Mateusz Jakub Fila eeb25dd2a5 added missing finding asm/ptrace.h in cmake 2023-12-27 01:58:25 +01:00
Mateusz Jakub Fila 4e9fd729d2 added missing finding `HAVE___ATTRIBUTE__ALIGNED_FN` in cmake 2023-12-27 01:58:11 +01:00
Mateusz Jakub Fila ad4a6ff8de added missing gcc unwinder preference option in cmake 2023-12-27 01:57:46 +01:00
Mateusz Jakub Fila 8987d08f79 fixed setting pagesize and pageshift in cmake 2023-12-24 01:51:00 +01:00
Mateusz Jakub Fila b8e75ae6fe Add mallinfo2 function 2023-12-07 14:10:51 +01:00