summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* bumped version to 2.7rcgperftools-2.6.90Aliaksey Kandratsenka2018-03-184-7/+27
|
* Add a central free list for kMaxPages-sized spansTodd Lipcon2018-03-177-29/+31
| | | | | | | | | | | | | | | | | | | | Previously, the central free list with index '0' was always unused, since freelist index 'i' tracked spans of length 'i' and there are no spans of length 0. This meant that there was no freelist for spans of length 'kMaxPages'. In the default configuration, this corresponds to 1MB, which is a relatively common allocation size in a lot of applications. This changes the free list indexing so that index 'i' tracks spans of length 'i + 1', meaning that free list index 0 is now used and freelist[kMaxPages - 1] tracks allocations of kMaxPages size (1MB by default). This also fixes the stats output to indicate '>128' for the large spans stats rather than the incorrect '>255' which must have referred to a historical value of kMaxPages. No new tests are added since this code is covered by existing tests.
* implement more robust detection of sized delete supportAliaksey Kandratsenka2018-03-041-4/+5
| | | | | | | | | | | | | As reported in issue #954, osx clang compiler is able to optimize our previous detection away while not really having runtime support for sized delete. So this time we use AC_LINK_IFELSE and more robust code to prevent compiler from optimizing away sized delete call. This should reliably catch "bad" compilers. Special thanks to Alexey Serbin for reporting the issue, suggesting a fix and verifying it. Fixes issue #954.
* refactored handling of reverse span set iterator for correctnessAliaksey Kandratsenka2018-02-252-25/+40
| | | | | I.e. no more questionable memcpy and we run iterator's destructor when we remove span from SpanSet.
* Update docs for central page heap to reflect treeTodd Lipcon2018-02-253-17/+26
|
* Implemented O(log n) searching among large spansAliaksey Kandratsenka2018-02-255-63/+234
| | | | | | | | | | | | | | | | | | This is implemented via std::set with custom STL allocator that delegates to PageHeapAllocator. Free large spans are not linked together via linked list, but inserted into std::set. Spans also store iterators to std::set positions pointing to them. So that removing span from set is fast too. Patch implemented by Aliaksey Kandratsenka and Todd Lipcon based on earlier research and experimentation by James Golick. Addresses issue #535 [alkondratenko@gmail.com: added Todd's fix for building on OSX] [alkondratenko@gmail.com: removed unnecessary Span constructor] [alkondratenko@gmail.com: added const for SpanSet comparator] [alkondratenko@gmail.com: added operator != for STLPageHeapAllocator]
* typo in docs/tcmalloc.htmlIshan Arora2018-01-091-1/+1
|
* bumped version to 2.6.3gperftools-2.6.3Aliaksey Kandratsenka2017-12-094-7/+19
|
* fix malloc fast path for patched windows functionsAliaksey Kandratsenka2017-12-091-5/+5
| | | | | | malloc_fast_path now receives oom function instead of full allocation function and windows/patch_function.cc wasn't updated until now. It caused assertion failures as reported in issue #944.
* configure.ac: use link check for std::align_val_tStephan Zuercher2017-12-091-1/+1
|
* configure.ac: better test for -faligned-newStephan Zuercher2017-12-091-1/+1
| | | | | XCode 9 provides only partial support for aligned new/delete when -faligned-new is specified. Require successful linking to enable aligned new/delete.
* bumped version to 2.6.2gperftools-2.6.2Aliaksey Kandratsenka2017-11-304-7/+55
|
* implement fast-path for memalign/aligned_alloc/tc_new_alignedAliaksey Kandratsenka2017-11-302-106/+101
| | | | | | | | | | We're taking advantage of "natural" alignedness of our size classes and instead of previous loop over size classes looking for suitably aligned size, we now directly compute right size. See align_size_up function. And that gives us ability to use our existing malloc fast-path to make memalign neat and fast in most common cases. I.e. memalign/aligned_alloc now only tail calls and thus avoids expensive prologue/epilogue and is almost as fast as regular malloc.
* add memalign benchmark to malloc_benchAliaksey Kandratsenka2017-11-301-0/+29
|
* always define empty PERFTOOLS_NOTHROWAliaksey Kandratsenka2017-11-291-2/+0
| | | | | | | | | | Because somehow clang still builds "this function will not throw" code even with noexcept. Which breaks performance of tc_malloc/tc_new_nothrow. The difference with throw() seems to be just which function is called when unexpected exception happens. So we work around this sillyness by simply dropping any exception specification when compiling tcmalloc.
* unbreak throw declarations on operators new/deleteAliaksey Kandratsenka2017-11-296-70/+67
| | | | | | | | | | | | | | | | | | | | | We now clearly separate PERFTOOLS_NOTHROW (used for tc_XXX functions) and throw()/noexcept (used for operators we define). The former is basically "nothrow() for our callers, nothing for us". It is roughly equivalent of what glibc declares for malloc and friends. If some exception-full C++ code calls such function it doesn't have to bother setting up exception handling around such call. Notably, it is still important for those functions to _not have throw() declarations when we're building tcmalloc. Because C++ throw() requires setting up handling of unexpected exceptions thrown from under such functions which we don't want. The later is necessary to have operators new/delete definitions have "correct" exception specifications to calm down compiler warnings. Particularly older clang versions warn if new/delete aren't defined with correct exception specifications. Also this commit fixes annoying gcc 7+ warning (and gnu++14 mode) that complains about throw() being deprecated.
* Fix OOM handling in fast-pathAliaksey Kandratsenka2017-11-294-21/+126
| | | | | | | | | | | | Previous fast-path malloc implementation failed to arrange proper oom handling for operator new. I.e. operator new is supposed to call new handler and throw exception, which was not arranged in fast-path case. Fixed code now passes pointer for oom function to ThreadCache::FetchFromCentralCache which will call it in oom condition. Test is added to verify correct behavior. I've also updated some fast-path-related comments for more accuracy.
* delete-trailing-whitespace on thread_cache.*Aliaksey Kandratsenka2017-11-292-3/+2
|
* reintroduce aliasing for aligned deleteAliaksey Kandratsenka2017-11-291-32/+54
| | | | | | | Without aliasing performance is likely to be at least partially affected. There is still concern that aliasing between functions of different signatures is not 100% safe. We now explicitly list of architectures where aliasing is known to be safe.
* fully disable aligned new on windows for nowAliaksey Kandratsenka2017-11-292-2/+2
|
* Add support for C++17 operator new/delete for overaligned types.Andrey Semashev2017-11-2910-35/+480
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add auto-detection of std::align_val_t presence to configure scripts. This indicates that the compiler supports C++17 operator new/delete overloads for overaligned types. - Add auto-detection of -faligned-new compiler option that appeared in gcc 7. The option allows the compiler to generate calls to the new operators. It is needed for tests. - Added overrides for the new operators. The overrides are enabled if the support for std::align_val_t has been detected. The implementation is mostly based on the infrastructure used by memalign, which had to be extended to support being used by C++ operators in addition to C functions. In particular, the debug version of the library has to distinguish memory allocated by memalign from that by operator new. The current implementation of sized overaligned delete operators do not make use of the supplied size argument except for the debug allocator because it is difficult to calculate the exact allocation size that was used to allocate memory with alignment. This can be done in the future. - Removed forward declaration of std::nothrow_t. This was not portable as the standard library is not required to provide nothrow_t directly in namespace std (it could use e.g. an inline namespace within std). The <new> header needs to be included for std::align_val_t anyway. - Fixed operator delete[] implementation in libc_override_redefine.h. - Moved TC_ALIAS definition to the beginning of the file in tcmalloc.cc so that the macro is defined before its first use in nallocx. - Added tests to verify the added operators. [alkondratenko@gmail.com: fixed couple minor warnings, and some whitespace change] [alkondratenko@gmail.com: removed addition of TC_ALIAS in debug allocator] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Add new statistics for the PageHeapAndrew Morrow2017-11-283-1/+76
| | | | | [alkondratenko@gmail.com: addressed init order mismatch warning] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Fix data race setting size_left_ in ThreadCache::SetMaxSizeJianbo Yang2017-10-172-21/+13
| | | | | | | | | | | | | | | This commit is to fix the data race in ThreadCache::SetMaxSize. ThreadCache::size_left_ is removed and ThreadCache::size_ is added. ThreadCache::size_left_ was introduced for optimization. It is updated in several functions of ThreadCache, including the ThreadCache::SetMaxSize. But thread A can update size_left_ of thread B via SetMaxSize without protection or synchronization. There should not be data race around ThreadCache::size_, for it isn't accessed by multi threads. The optimization of tail-call in tc_{malloc, new, free} is kept and no other logics are affected.
* fix memory leak in Symbolize functioncs-lee2017-09-231-0/+1
| | | | | [alkondratenko@gmail.com: reworded commit message] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Added mising va_end() in TracePrintf functioncs-lee2017-09-231-0/+1
| | | | | | | | Normally the va_end function does not do anything, but it should be called because some platforms need it. [alkondratenko@gmail.com: reworded commit message] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Implemented GetProgramInvocationName on FreeBSDVladimir2017-09-231-0/+10
| | | | | | | | Few lines of code was taken from /usr/src/contrib/libexecinfo/backtrace.c [alkondratenko@gmail.com: updated commit message Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* Revert "Ignore current_instance heap allocation when leak sanitizer is enabled"Aliaksey Kandratsenka2017-09-232-16/+0
| | | | This reverts commit 70a35422b5509a456584b132ad8ce4466af323ea.
* Revert "Ensure that lsan flags are appended on all necessary targets"Aliaksey Kandratsenka2017-09-231-6/+2
| | | | This reverts commit a3bf61ca81b68e7792739c451aceef00cf7d7d03.
* Use safe getenv for setting up backtrace capturing methodAliaksey Kandratsenka2017-09-231-1/+2
| | | | | This code runs very early, so using special "early" version of getenv is reasonable. It should fix issue #912.
* Fixed LTO warning about the mismatch between return values for ↵Dorin Lazăr2017-09-231-2/+2
| | | | ProfilingIsEnabledForAllThreads()
* implement support for C11 aligned_allocAliaksey Kandratsenka2017-09-163-0/+3
| | | | Just like glibc does, we simply alias it to memalign.
* Fix build on macOS.Piotr Sikora2017-08-211-0/+2
| | | | | | Fixes #910. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* include fcntl.h for loff_t definitionKhem Raj2017-07-161-0/+1
| | | | | | | Fixes linux_syscall_support.h:2641:26: error: 'loff_t' has not been declared Signed-off-by: Khem Raj <raj.khem@gmail.com>
* Use ucontext_t instead of struct ucontextKhem Raj2017-07-161-2/+1
| | | | | | Newer glibc has dropped the ucontext tag from exposing Signed-off-by: Khem Raj <raj.khem@gmail.com>
* bumped version to 2.6.1gperftools-2.6.1Aliaksey Kandratsenka2017-07-094-7/+24
|
* Replace "throw()" by "PERFTOOLS_NOTHROW"Romain Geissler2017-07-094-29/+29
| | | | | | | | | Automatically done with: sed -e 's/\<throw[[:space:]]*([[:space:]]*)/PERFTOOLS_NOTHROW/g' -i $(git grep -l 'throw[[:space:]]*([[:space:]]*)') [alkondratenko@gmail.com: updated to define empty PERFTOOLS_NOTHROW only on pre-c++11 standards]
* Add PERFTOOLS_THROW where necessary (as detected by GCC).Romain Geissler2017-07-083-3/+10
|
* Rename PERFTOOLS_THROW into PERFTOOLS_NOTHROW.Romain Geissler2017-07-085-164/+164
| | | | | Automatically done with: sed -e 's/\<PERFTOOLS_THROW\>/PERFTOOLS_NOTHROW/g' -i $(git grep -l PERFTOOLS_THROW)
* Register tcmalloc atfork handler as early as possibleAliaksey Kandratsenka2017-07-083-9/+41
| | | | | | | | | | | This is what other mallocs do (glibc malloc and jemalloc). The idea is malloc is usually initialized very eary. So if we register atfork handler at that time, we're likely to be first. And that makes our atfork handler a bit safer, since there is much less chance of some other library installing their "take all locks" handler first and having fork take malloc lock before library's lock and deadlocking. This should address issue #904.
* Add initial syscall support for mips64 32-bit ABIAliaksey Kandratsenka2017-07-082-5/+11
| | | | | | | This applies patch by Adhemerval Zanella from https://github.com/gperftools/gperftools/issues/845. Only malloc (i.e. tcmalloc_minimal) was tested to work so far.
* Ensure that lsan flags are appended on all necessary targetsFrancis Ricci2017-07-081-2/+6
|
* Add missing NEWS entry for recent 2.6 releaseAliaksey Kandratsenka2017-07-041-0/+3
| | | | | Somehow I managed to miss this last commit in 2.6 release. So lets add it now even if it is too late.
* bumped version up to 2.6gperftools-2.6Aliaksey Kandratsenka2017-07-044-8/+23
|
* Ignore current_instance heap allocation when leak sanitizer is enabledFrancis Ricci2017-07-042-0/+16
| | | | | | Without this patch, any user program that enables LeakSanitizer will see a leak from tcmalloc. Add a weak hook to __lsan_ignore_object, so that if LeakSanitizer is enabled, the allocation can be ignored.
* Revert "issue-654: [pprof] handle split text segments"Aliaksey Kandratsenka2017-07-011-14/+0
| | | | | | | This reverts commit 8c3dc52fcfe02412a529769a22cbc75388a5d368. People have reported issues with this so lets stay safe and use older even if less powerful code.
* update the prev_class_size in each loop, or the min_object_size of ↵KernelMaker2017-05-291-0/+2
| | | | tcmalloc.thread will always be 1 when calling GetFreeListSizes
* Document HEAPPROFILESIGNAL environment variableKim Gräsman2017-05-291-0/+9
|
* added stacktrace capturing benchmarkAliaksey Kandratsenka2017-05-294-0/+157
|
* 2.6rc4gperftools-2.5.93Aliaksey Kandratsenka2017-05-224-7/+16
|
* Revert "Revert "disable dynamic sized delete support by default""Aliaksey Kandratsenka2017-05-221-16/+3
| | | | | | | | | | | | | | | This reverts commit b82d89cb7c8781a6028f6f5959cabdc5a273aec3. Dynamic sized delete support relies on ifunc handler being able to look up environment variable. The issue is, when stuff is linked with -z now linker flags, all relocations are performed early. And sadly ifunc relocations are not treated specially. So when ifunc handler runs, it cannot rely on any dynamic relocations at all, otherwise crash is real possibility. So we cannot afford doing it until (and if) ifunc is fixed. This was brought to my attention by Fedora people at https://bugzilla.redhat.com/show_bug.cgi?id=1452813