Commit Graph

502 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
b82d89cb7c Revert "disable dynamic sized delete support by default"
This reverts commit 06811b3ae4.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
fac0bb44d5 Do not depend on memchr in commandlineflags::StringToBool
It lets us use it from inside ifunc handler.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
7d49f015a0 Make GetenvBeforeMain work inside ifunc handler
Depending on things such us strlen, which are ifunc-ed themselves is
not supported from inside ifunc handler.

Thus we implement strlen, memchr and memcmp in slow naive C++ just for
that place.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
a2550b6309 turn bench_fastpath_throughput into actual throughput benchmark
Previously we bumped size by 16 between iterations, but for many size
classess that gave is subsequent iteration into same size
class. Multiplying by prime number randomizes sizes more so speeds up
this benchmark on at least modern x86.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
b762b1a492 added sized free benchmarks to malloc_bench 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
71ffc1cd6b added free lists randomization step to malloc_bench 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
732dfeb83d Run StartStopNoOptionsEmpty profiledata unittest
Somehow we had this test, but didn't arrange to actually run it. GCC
gave warning and now we do.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
cbb312fbe8 aggressive decommit: only free necessary regions and fix O(N²)
We used to decommit (with MADV_FREE or MADV_DONTNEED) whole combined
span when freeing span in aggressive decommit mode. The issue with
that is preceding or following span with which we combined span we're
freeing could be freed already and fairly large. By passing all of
that memory to decommit, we force kernel to scan all of those pages.

When mass-freeing many objects old behavior led to O(N^2) behavior
since freeing single span could lead to MADV_{FREE,DONTNEED}-ing of
most of the heap.

New implementation just does decommit of individual bits as needed.

While there, I'm also adding locking to calls of
PageHeap::{Get,Set}AggressiveDecommit.

This partially (or mostly) fixes issue #839.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
6d98223a90 don't build with -fno-exceptions
It looks like, in past it could produce better code. But since
unwinding is totally different since almost forever now, there is no
perfomance benefit of it anymore.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
d6a1931cce fixed warning in casting heap of checker's main_thread_counter
I.e. compiler didn't like int to void * casting and upcasting to
intptr_t first (which has same size as void *) makes it happier.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
5c778701d9 added tcmalloc minimal unittest with ASSERTs checked 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
a9167617ab drop unused g_load_map variable in patch_functionc.cc 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
d52e56dcb5 don't compare integer to NULL 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
bae00c0341 add fake_stacktrace_scope to few msvc projects
Otherwise it predictably fails at linking phase due to missing
symbols.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
79aab4fed4 correctly dllexport nallocx on windows 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
b010895a08 don't undef PERFTOOLS_DLL_DECL
This is not necessary and will help adding more headers with
dll-exported functions.
2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
491b1aca7e don't try to use pthread_atfork on windows 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
691045b957 suppress warnings from legacy headers while building legacy headers test 2017-05-14 19:04:55 -07:00
Aliaksey Kandratsenka
22f7ceb97a use unsigned for few flags in mini_disassembler_types.h
We're initializing them with value that doesn't fit into signed 32-bit
int and somehow mingw version that I have not just warns, but actually
errors on that.
2017-05-14 19:04:55 -07:00
Mostyn Bramley-Moore
9b17a8a5ba remove superfluous size_t value >= 0 check 2017-05-14 18:01:18 -07:00
Eugene
86ce69d77f Update binary_trees.cc 2017-04-16 13:26:20 -07:00
Ola Olsson
cd8586ed6c Fix path names in README 2017-04-16 13:23:22 -07:00
Aliaksey Kandratsenka
98753aa737 test that sized deallocation really works before enabling it
Weirdly, some OSX compiler does allow -fsized-deallocation, yet barks
on any attempt to actually use it at compile time (!). So lets detect
this as well in configure and opt out as necessary.

Should fix issue #870.
2017-02-20 16:04:14 -08:00
Aliaksey Kandratsenka
5618ef7850 Don't assume memalign exists in memalign vs nallocx test
OSX and windows have issues with memalign. So test against tc_memalign
instead.

This should fix _memalign linker-time part of issue #870.
2017-02-20 15:35:24 -08:00
Aliaksey Kandratsenka
bf640cd740 rename sys allocator's sys_alloc symbol to tcmalloc_sys_alloc
Since we're not building with hidden visibility, symbols of other DSOs
can interpose our symbols. And sys_alloc is just too generic name.

And in fact erlang runtime has sys_alloc function. Which means we're
trying to write to it's first bytes as part of initializing system
allocator and crash.

This should fix issue #843.
2017-02-20 14:55:23 -08:00
Aliaksey Kandratsenka
069e3b1655 build malloc_bench_shared_full only when full tcmalloc is built
I.e. because otherwise, when --enable-minimal is given, we're building
empty libtcmalloc.la and linking it to malloc_bench_shared_full. Which
has no effect at all and actually breaks builds on OSX.

Should fix issue #869.
2017-02-20 14:26:54 -08:00
Aliaksey Kandratsenka
b8f9d0d44f ported nallocx support from Google-internal tcmalloc
nallocx is extension introduced by jemalloc. It returns effective size
of allocaiton without allocating anything.

We also support MALLOCX_LG_ALIGN flag. But all other jemalloc
flags (which at the moment do nothing for nallocx anyways) are
silently ignored, since there is no sensible way to return errors in
this API.

This was originally contributed by Dmitry Vyukov with input from
Andrew Hunter. But due to significant divergence of Google-internal
and free-software forks of tcmalloc, significant massaging was done by
me. So all bugs are mine.
2016-12-18 12:53:47 -08:00
Andrew Morrow
b0abefd938 Fix a typo in the page fence flag declaration 2016-12-17 13:57:41 -05:00
Kirill Müller
855b380006 replace docs by doc 2016-11-19 15:04:44 -08:00
Kirill Müller
664210ead8 doc -> docs, with symlink 2016-11-19 15:04:43 -08:00
zmertens
75dc9a6e14 Fix Post(s)cript tyos 2016-11-19 15:03:06 -08:00
Francis Ricci
dde32f8bbc Fix unaligned memory accesses in debug allocator 2016-10-16 13:23:03 -07:00
Ryan Macnak
02eeed29df Fix redefinition of mmap on aarch64. 2016-09-27 14:08:10 -07:00
Aliaksey Kandratsenka
c07a15cff4 [windows] patch _free_base as well
Looks like _free_base is used as generic free/delete, which is not
checked for free/delete mismatch by their debug runtime. Issue #817
occurs because something that is allocated by regular allocation
functions (new or malloc) is freed by _free_base. Patch it as well fixes
the problem.

Closes #817.
2016-09-24 18:56:22 -07:00
Aliaksey Kandratsenka
acac6af26b Fix finding default zone on macOS sierra
This is taken from jemalloc patch at
19c9a3e828
by Mike Hommey (aka glandium).

The issue was reported together with advise to take that jemalloc fix by
Koichi Shiraishi and David Ribeiro Alves at gperftools issue #827.

Closes issue #827.
2016-09-24 16:19:27 -07:00
Tulio Magno Quites Machado Filho
7822b5b0b9 Stop using glibc malloc hooks
glibc deprecated malloc hooks in 2011 and will be removing them soon.
These hooks aren't safe and aren't necessary when the malloc API is
fully exported.
2016-08-24 22:36:04 -07:00
Tulio Magno Quites Machado Filho
c92f0ed089 Remove references to __malloc_initialize_hook
__malloc_initialize_hook has been deprecated in glibc since 2011 and is
being removed on glibc 2.24.
2016-08-24 22:36:04 -07:00
Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)
9709eef361 Merge pull request #821 from jtmcdole/patch-1
Rename TCMALLOC_DEBUG to PERFTOOLS_VERBOSE
2016-08-24 22:33:05 -07:00
John McDole
44f276e132 Rename TCMALLOC_DEBUG to PERFTOOLS_VERBOSE 2016-08-24 17:47:28 -07:00
Aliaksey Kandratsenka
eb474c995e Summary: support gcc atomic ops on clang too
Clang actually does support __atomic_XXX atomic ops builtins but does
not advertise itselt as gcc 4.7 or later. So we now detect clang
separetely.

We're enabling gcc atomic ops on clang >= 3.4 since this is the oldest
version that I can test.

This should fix issue #797.
2016-07-03 18:21:42 -07:00
Kenton Varda
7f86eab1f3 Recognize .node files as shared libraries
node.js extensions are regular shared libraries named with the `.node` extension. With this small change I was able to get a usable heap profile out of node to debug an extension I'm working on.
2016-07-02 08:52:21 -07:00
Bryan Chan
bf8eacce69 Add support for 31-bit s390; merge linux_syscall_support.h changes from upstream. 2016-06-25 17:12:09 -07:00
savefromgoogle
c54218069b Update README
typo corrected and direct link to Google Group mailinglist added
2016-06-25 17:08:10 -07:00
iivlev
06f4ce65c2 Small performance tweak: avoid calling time() if we don't need it 2016-06-25 17:03:27 -07:00
Aliaksey Kandratsenka
db8d483609 Autogenerate ChangeLog from git on make dist
This fixes build breakage introduced in preceding commit for issue #796.
2016-06-25 16:31:29 -07:00
Aliaksey Kandratsenka
4a13598319 renamed ChangeLog to ChangeLog.old
I.e. to avoid confusion. This should fix issue #796.
2016-06-25 16:12:52 -07:00
Aliaksey Kandratsenka
7852eeb75b Use initial-exec tls for libunwind's recursion flag
If we don't do it, then reading variable calls to __tls_get_addr, which
uses malloc on first call. initial-exec makes dynamic linker reserve tls
offset for recusion flag early and thus avoid unsafe calls to malloc.

This fixes issue #786.
2016-04-09 13:09:18 -07:00
Mike Gaffney
a07f9fe75a gerftools -> gperftools in readme 2016-03-31 11:27:21 -07:00
Aliaksey Kandratsenka
9fd6d26879 added define to enable MADV_FREE usage on Linux
Building with -DTCMALLOC_USE_MADV_FREE will enable usage of MADV_FREE on
Linux if glibc copy of kernel headers has MADV_FREE defined.

I.e. so that people can test this more easily.

Affects ticket #780.
2016-03-20 12:30:54 -07:00
Mathias Stearn
6f7a14f45e Don't use MADV_FREE on Linux
Addresses #780.
2016-03-16 18:22:32 -04:00