History log of /external/jemalloc/src/jemalloc.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
54d4dfa33617e5df0d02b8b6135a64312fba9fe0 03-Mar-2016 Christopher Ferris <cferris@google.com> Update generated files for 4.1.0 update.

Removed the hack to do an always purge. Instead use the new decay
purging mechanism, but set the decay timeout to 0 so it always purges
without the need to change the code.

Added back the a0get function to use for huge chunk allocation patch
we use for android.

Bug: 27408522

(cherry picked from commit 473a1853074261bb265060e04deeb8efb0fe6fac)

Change-Id: I2f6ab9be8784b039a08f83a8143785b3d8bcd5cf
/external/jemalloc/src/jemalloc.c
e42940346e47de63bfc47470c86c3c132ec2db8c 02-Mar-2016 Christopher Ferris <cferris@google.com> Merge remote-tracking branch 'aosp/upstream-dev' into merge

Bug: 26807329
(cherry picked from commit fb9c9c8d5230956caa48501dad4fde4b90e00319)

Change-Id: I428ae6395d8c00db6baef5313b3dd47b68444bd9
/external/jemalloc/src/jemalloc.c
368f61eb45edd0ed92db68ff0c8c3c0d998ab010 30-Dec-2015 Colin Cross <ccross@android.com> Add je_iterate, je_malloc_disable, and je_malloc_enable

je_iterate calls a callback for every active jemalloc allocation in a
block of memory. je_malloc_disable prevents allocations to avoid
mutating the jemalloc internal data structures while je_iterate is
running, and je_malloc_enable re-enables allocations.

Bug: 27208635
(cherry picked from commit 6ab5f60a1e0d2b09ec7961b6e2d2c2a39e9c96f2)

Change-Id: Ia5360c940509048532263f3a0dfb296d9e20a8aa
/external/jemalloc/src/jemalloc.c
6be84e0ca9e04c8ebe7fc10c5e8eef7f4ac15a12 02-Feb-2016 Christopher Ferris <cferris@google.com> Merge remote-tracking branch 'aosp/upstream-dev' into merge

Bug: 24264290
9cb481a73f6d2b518f695a669c1f850e477fdd2c 11-Jan-2016 Cosmin Paraschiv <cparaschiv@ixiacom.com> Call malloc_test_boot0() from malloc_init_hard_recursible().

When using LinuxThreads, malloc bootstrapping deadlocks, since
malloc_tsd_boot0() ends up calling pthread_setspecific(), which causes
recursive allocation. Fix it by moving the malloc_tsd_boot0() call to
malloc_init_hard_recursible().

The deadlock was introduced by 8bb3198f72fc7587dc93527f9f19fb5be52fa553
(Refactor/fix arenas manipulation.), when tsd_boot() was split and the
top half, tsd_boot0(), got an extra tsd_wrapper_set() call.
/external/jemalloc/src/jemalloc.c
f4a0f32d340985de477bbe329ecdaecd69ed1055 27-Oct-2015 Qi Wang <interwq@gwu.edu> Fast-path improvement: reduce # of branches and unnecessary operations.

- Combine multiple runtime branches into a single malloc_slow check.
- Avoid calling arena_choose / size2index / index2size on fast path.
- A few micro optimizations.
/external/jemalloc/src/jemalloc.c
21523297fcd72128c14b40ebefbf8ccf114fbede 18-Sep-2015 Jason Evans <jasone@canonware.com> Add mallocx() OOM tests.
/external/jemalloc/src/jemalloc.c
3263be6efb5232963c0820da65e235d1693e404d 17-Sep-2015 Jason Evans <jasone@canonware.com> Simplify imallocx_prof_sample().

Simplify imallocx_prof_sample() to always operate on usize rather than
sometimes using size. This avoids redundant usize computations and
more closely fits the style adopted by i[rx]allocx_prof_sample() to fix
sampling bugs.
/external/jemalloc/src/jemalloc.c
4be9c79f881066f4d3424d45d7845c03e1032d3c 17-Sep-2015 Jason Evans <jasone@canonware.com> Fix irallocx_prof_sample().

Fix irallocx_prof_sample() to always allocate large regions, even when
alignment is non-zero.
/external/jemalloc/src/jemalloc.c
38e2c8fa9c4a2a0613609b8b88a355670a2f9770 17-Sep-2015 Jason Evans <jasone@canonware.com> Fix ixallocx_prof_sample().

Fix ixallocx_prof_sample() to never modify nor create sampled small
allocations. xallocx() is in general incapable of moving small
allocations, so this fix removes buggy code without loss of generality.
/external/jemalloc/src/jemalloc.c
9a505b768cd50bffbfaa3a993df9117e7454134e 15-Sep-2015 Jason Evans <jasone@canonware.com> Centralize xallocx() size[+extra] overflow checks.
/external/jemalloc/src/jemalloc.c
8c485b02a61ab96d4d248e234302edf57577b77d 15-Sep-2015 Jason Evans <jasone@canonware.com> Fix ixallocx_prof() to check for size greater than HUGE_MAXCLASS.
/external/jemalloc/src/jemalloc.c
708ed79834fc3b8e5b14dbb0128a0ebfce63a38f 15-Sep-2015 Jason Evans <jasone@canonware.com> Resolve an unsupported special case in arena_prof_tctx_set().

Add arena_prof_tctx_reset() and use it instead of arena_prof_tctx_set()
when resetting the tctx pointer during reallocation, which happens
whenever an originally sampled reallocated object is not sampled during
reallocation.

This regression was introduced by
594c759f37c301d0245dc2accf4d4aaf9d202819 (Optimize
arena_prof_tctx_set().)
/external/jemalloc/src/jemalloc.c
23f6e103c871b4db5b315caf1a8d5c46d9675691 15-Sep-2015 Jason Evans <jasone@canonware.com> Fix ixallocx_prof_sample() argument order reversal.

Fix ixallocx_prof() to pass usize_max and zero to ixallocx_prof_sample()
in the correct order.
/external/jemalloc/src/jemalloc.c
ce9a4e34795a22838b97a5f10cd8090ab21f22fd 15-Sep-2015 Jason Evans <jasone@canonware.com> s/max_usize/usize_max/g
/external/jemalloc/src/jemalloc.c
d9704042ee436cdb329a0777ad350b9fef78891d 15-Sep-2015 Jason Evans <jasone@canonware.com> s/oldptr/old_ptr/g
/external/jemalloc/src/jemalloc.c
cec0d63d8bc46205d38456024176a0ece590253e 15-Sep-2015 Jason Evans <jasone@canonware.com> Make one call to prof_active_get_unlocked() per allocation event.

Make one call to prof_active_get_unlocked() per allocation event, and
use the result throughout the relevant functions that handle an
allocation event. Also add a missing check in prof_realloc(). These
fixes protect allocation events against concurrent prof_active changes.
/external/jemalloc/src/jemalloc.c
ef363de7010b5e13f4e1c0d7b3a109362bda7aa7 15-Sep-2015 Jason Evans <jasone@canonware.com> Fix irealloc_prof() to prof_alloc_rollback() on OOM.
/external/jemalloc/src/jemalloc.c
46ff0491280635e51c9771d56a2d64dc0c4d6bd2 15-Sep-2015 Jason Evans <jasone@canonware.com> Optimize irallocx_prof() to optimistically update the sampler state.
/external/jemalloc/src/jemalloc.c
4acb6c7ff3411ddc4d180b0cbdba4fd2c3651ef0 15-Sep-2015 Jason Evans <jasone@canonware.com> Fix ixallocx_prof() size+extra overflow.

Fix ixallocx_prof() to clamp the extra parameter if size+extra would
overflow HUGE_MAXCLASS.
/external/jemalloc/src/jemalloc.c
6f50cbc975f782b7576ed699a7c2b123655d1b95 09-Sep-2015 Christopher Ferris <cferris@google.com> Regenerate files and re-add android changes.

Update to the jemalloc top of tree and regenerate all of the files
using configure.

Also, re-add all of small the android changes.

In addition, add a new define to allow the chunk size to be changed
easily. Use this define to set the chunk size to 512K for the 32 bit
library, and set the chunk size to 2MB for the 64 bit library.

Bug: 23633724
Change-Id: I9daef0428e6c22e56eb7b05089f9a3f6e2f86d82
/external/jemalloc/src/jemalloc.c
0a116faf95ba8541ce75448bb9b6fba0efdde69a 03-Sep-2015 Mike Hommey <mh@glandium.org> Force initialization of the init_lock in malloc_init_hard on Windows XP

This resolves #269.
/external/jemalloc/src/jemalloc.c
30949da601f7405c294a71d30bd67be29cfbc2a5 26-Aug-2015 Jason Evans <je@fb.com> Fix arenas_cache_cleanup() and arena_get_hard().

Fix arenas_cache_cleanup() and arena_get_hard() to handle
allocation/deallocation within the application's thread-specific data
cleanup functions even after arenas_cache is torn down.

This is a more general fix that complements
45e9f66c280e1ba8bebf7bed387a43bc9e45536d (Fix arenas_cache_cleanup().).
/external/jemalloc/src/jemalloc.c
45e9f66c280e1ba8bebf7bed387a43bc9e45536d 21-Aug-2015 Christopher Ferris <cferris@google.com> Fix arenas_cache_cleanup().

Fix arenas_cache_cleanup() to handle allocation/deallocation within the
application's thread-specific data cleanup functions even after
arenas_cache is torn down.
/external/jemalloc/src/jemalloc.c
c1a6a51e401eb888caff5de142280754e7d99ba3 27-Jul-2015 Matthijs <mlvdmeide@gmail.com> MSVC compatibility changes

- Decorate public function with __declspec(allocator) and __declspec(restrict), just like MSVC 1900
- Support JEMALLOC_HAS_RESTRICT by defining the restrict keyword
- Move __declspec(nothrow) between 'void' and '*' so it compiles once more
/external/jemalloc/src/jemalloc.c
00632609dfdd28e8de5afdd3e838f3975566e5d9 21-Jul-2015 Jason Evans <jasone@canonware.com> Move JEMALLOC_NOTHROW just after return type.

Only use __declspec(nothrow) in C++ mode.

This resolves #244.
/external/jemalloc/src/jemalloc.c
50cd636eedfdc14d68f3917055fe2cc3fc72e853 21-Jul-2015 Mike Hommey <mh@glandium.org> Remove JEMALLOC_ALLOC_SIZE annotations on functions not returning pointers

As per gcc documentation:
The alloc_size attribute is used to tell the compiler that the function
return value points to memory (...)

This resolves #245.
/external/jemalloc/src/jemalloc.c
ae93d6bf364e9db9f9ee69c3e5f9df110d8685a4 10-Jul-2015 Jason Evans <jasone@canonware.com> Avoid function prototype incompatibilities.

Add various function attributes to the exported functions to give the
compiler more information to work with during optimization, and also
specify throw() when compiling with C++ on Linux, in order to adequately
match what __THROW does in glibc.

This resolves #237.
/external/jemalloc/src/jemalloc.c
a1aaf949a5d3b639f03dd7e33ffe1f0849b7f8df 25-Jun-2015 Matthijs <mlvdmeide@gmail.com> Optimizations for Windows

- Set opt_lg_chunk based on run-time OS setting
- Verify LG_PAGE is compatible with run-time OS setting
- When targeting Windows Vista or newer, use SRWLOCK instead of CRITICAL_SECTION
- When targeting Windows Vista or newer, statically initialize init_lock
/external/jemalloc/src/jemalloc.c
241abc601b947c5e0e56791bd73a924ce872b4a1 24-Jun-2015 Jason Evans <jasone@canonware.com> Fix size class overflow handling when profiling is enabled.

Fix size class overflow handling for malloc(), posix_memalign(),
memalign(), calloc(), and realloc() when profiling is enabled.

Remove an assertion that erroneously caused arena_sdalloc() to fail when
profiling was enabled.

This resolves #232.
/external/jemalloc/src/jemalloc.c
dc0610a714c1ff207bf87ba907506ae0b111e092 23-Jun-2015 Jason Evans <jasone@canonware.com> Add alignment assertions to public aligned allocation functions.
/external/jemalloc/src/jemalloc.c
8a03cf039cd06f9fa6972711195055d865673966 04-May-2015 Jason Evans <jasone@canonware.com> Implement cache index randomization for large allocations.

Extract szad size quantization into {extent,run}_quantize(), and .
quantize szad run sizes to the union of valid small region run sizes and
large run sizes.

Refactor iteration in arena_run_first_fit() to use
run_quantize{,_first,_next(), and add support for padded large runs.

For large allocations that have no specified alignment constraints,
compute a pseudo-random offset from the beginning of the first backing
page that is a multiple of the cache line size. Under typical
configurations with 4-KiB pages and 64-byte cache lines this results in
a uniform distribution among 64 page boundary offsets.

Add the --disable-cache-oblivious option, primarily intended for
performance testing.

This resolves #13.
/external/jemalloc/src/jemalloc.c
95e88de0aab257020dfc33248b86331cbfac28b1 23-Mar-2015 Igor Podlesny <user.email@poige.ru> Concise JEMALLOC_HAVE_ISSETUGID case in secure_getenv().
/external/jemalloc/src/jemalloc.c
e0a08a14962c8d6b09fd25ba9f3f6c57d5a4f844 19-Mar-2015 Jason Evans <jasone@canonware.com> Restore --enable-ivsalloc.

However, unlike before it was removed do not force --enable-ivsalloc
when Darwin zone allocator integration is enabled, since the zone
allocator code uses ivsalloc() regardless of whether
malloc_usable_size() and sallocx() do.

This resolves #211.
/external/jemalloc/src/jemalloc.c
b01186cebd9828e91a488d86980544bacb01e1a6 15-Feb-2015 Jason Evans <jasone@canonware.com> Remove redundant tcache_boot() call.
/external/jemalloc/src/jemalloc.c
cbf3a6d70371d2390b8b0e76814e04cc6088002c 11-Feb-2015 Jason Evans <jasone@canonware.com> Move centralized chunk management into arenas.

Migrate all centralized data structures related to huge allocations and
recyclable chunks into arena_t, so that each arena can manage huge
allocations and recyclable virtual memory completely independently of
other arenas.

Add chunk node caching to arenas, in order to avoid contention on the
base allocator.

Use chunks_rtree to look up huge allocations rather than a red-black
tree. Maintain a per arena unsorted list of huge allocations (which
will be needed to enumerate huge allocations during arena reset).

Remove the --enable-ivsalloc option, make ivsalloc() always available,
and use it for size queries if --enable-debug is enabled. The only
practical implications to this removal are that 1) ivsalloc() is now
always available during live debugging (and the underlying radix tree is
available during core-based debugging), and 2) size query validation can
no longer be enabled independent of --enable-debug.

Remove the stats.chunks.{current,total,high} mallctls, and replace their
underlying statistics with simpler atomically updated counters used
exclusively for gdump triggering. These statistics are no longer very
useful because each arena manages chunks independently, and per arena
statistics provide similar information.

Simplify chunk synchronization code, now that base chunk allocation
cannot cause recursive lock acquisition.
/external/jemalloc/src/jemalloc.c
1cb181ed632e7573fb4eab194e4d216867222d27 30-Jan-2015 Jason Evans <je@fb.com> Implement explicit tcache support.

Add the MALLOCX_TCACHE() and MALLOCX_TCACHE_NONE macros, which can be
used in conjunction with the *allocx() API.

Add the tcache.create, tcache.flush, and tcache.destroy mallctls.

This resolves #145.
/external/jemalloc/src/jemalloc.c
4581b97809e7e545c38b996870a4e7284a620bc5 27-Nov-2014 Jason Evans <je@fb.com> Implement metadata statistics.

There are three categories of metadata:

- Base allocations are used for bootstrap-sensitive internal allocator
data structures.
- Arena chunk headers comprise pages which track the states of the
non-metadata pages.
- Internal allocations differ from application-originated allocations
in that they are for internal use, and that they are omitted from heap
profiles.

The metadata statistics comprise the metadata categories as follows:

- stats.metadata: All metadata -- base + arena chunk headers + internal
allocations.
- stats.arenas.<i>.metadata.mapped: Arena chunk headers.
- stats.arenas.<i>.metadata.allocated: Internal allocations. This is
reported separately from the other metadata statistics because it
overlaps with the allocated and active statistics, whereas the other
metadata statistics do not.

Base allocations are not reported separately, though their magnitude can
be computed by subtracting the arena-specific metadata.

This resolves #163.
/external/jemalloc/src/jemalloc.c
10aff3f3e1b8b3ac0348b259c439c9fe870a6b95 21-Jan-2015 Jason Evans <jasone@canonware.com> Refactor bootstrapping to delay tsd initialization.

Refactor bootstrapping to delay tsd initialization, primarily to support
integration with FreeBSD's libc.

Refactor a0*() for internal-only use, and add the
bootstrap_{malloc,calloc,free}() API for use by FreeBSD's libc. This
separation limits use of the a0*() functions to metadata allocation,
which doesn't require malloc/calloc/free API compatibility.

This resolves #170.
/external/jemalloc/src/jemalloc.c
bc96876f99e89705817630b503ac54a5c48789ab 21-Jan-2015 Jason Evans <je@fb.com> Fix arenas_cache_cleanup().

Fix arenas_cache_cleanup() to check whether arenas_cache is NULL before
deallocation, rather than checking arenas.
/external/jemalloc/src/jemalloc.c
44b57b8e8b25797b94c7cccc0e32705f76fcf03b 17-Jan-2015 Jason Evans <je@fb.com> Fix OOM handling in memalign() and valloc().

Fix memalign() and valloc() to heed imemalign()'s return value.

Reported by Kurt Wampler.
/external/jemalloc/src/jemalloc.c
2c5cb613dfbdf58f88152321b63e60c58cd23972 08-Dec-2014 Guilherme Goncalves <guilherme.p.gonc@gmail.com> Introduce two new modes of junk filling: "alloc" and "free".

In addition to true/false, opt.junk can now be either "alloc" or "free",
giving applications the possibility of junking memory only on allocation
or deallocation.

This resolves #172.
/external/jemalloc/src/jemalloc.c
b74041fb6e279bd8bbc133250241249f90cd619f 09-Dec-2014 Daniel Micay <danielmicay@gmail.com> Ignore MALLOC_CONF in set{uid,gid,cap} binaries.

This eliminates the malloc tunables as tools for an attacker.

Closes #173
/external/jemalloc/src/jemalloc.c
e12eaf93dca308a426c182956197b0eeb5f2cff3 08-Dec-2014 Jason Evans <je@fb.com> Style and spelling fixes.
/external/jemalloc/src/jemalloc.c
dc652131110abb480df608d17b20cf5bd4cfe2d4 31-Oct-2014 Daniel Micay <danielmicay@gmail.com> rm unused arena wrangling from xallocx

It has no use for the arena_t since unlike rallocx it never makes a new
memory allocation. It's just an unused parameter in ixalloc_helper.
/external/jemalloc/src/jemalloc.c
cfc5706f6977a48f3b82d69cd68aa1cf8802fb8d 31-Oct-2014 Jason Evans <jasone@canonware.com> Miscellaneous cleanups.
/external/jemalloc/src/jemalloc.c
d33f834591a2459f22da7a165c524340b5fc3a0c 24-Oct-2014 Daniel Micay <danielmicay@gmail.com> avoid redundant chunk header reads

* use sized deallocation in iralloct_realign
* iralloc and ixalloc always need the old size, so pass it in from the
caller where it's often already calculated
/external/jemalloc/src/jemalloc.c
809b0ac3919da60c20ad59517ef560d0df639f3b 23-Oct-2014 Daniel Micay <danielmicay@gmail.com> mark huge allocations as unlikely

This cleans up the fast path a bit more by moving away more code.
/external/jemalloc/src/jemalloc.c
81e547566e9bd55db7c317c5848ab9dc189047cb 11-Oct-2014 Jason Evans <jasone@canonware.com> Add --with-lg-tiny-min, generalize --with-lg-quantum.
/external/jemalloc/src/jemalloc.c
9b75677e538836b284a0d26a593963187c24a153 11-Oct-2014 Jason Evans <jasone@canonware.com> Don't fetch tsd in a0{d,}alloc().

Don't fetch tsd in a0{d,}alloc(), because doing so can cause infinite
recursion on systems that require an allocated tsd wrapper.
/external/jemalloc/src/jemalloc.c
fc0b3b7383373d66cfed2cd4e2faa272a6868d32 10-Oct-2014 Jason Evans <jasone@canonware.com> Add configure options.

Add:
--with-lg-page
--with-lg-page-sizes
--with-lg-size-class-group
--with-lg-quantum

Get rid of STATIC_PAGE_SHIFT, in favor of directly setting LG_PAGE.

Fix various edge conditions exposed by the configure options.
/external/jemalloc/src/jemalloc.c
3a8b9b1fd95b1bb9b3dc00f6798eeb40d5100b7b 08-Oct-2014 Jason Evans <je@fb.com> Fix a recursive lock acquisition regression.

Fix a recursive lock acquisition regression, which was introduced by
8bb3198f72fc7587dc93527f9f19fb5be52fa553 (Refactor/fix arenas
manipulation.).
/external/jemalloc/src/jemalloc.c
f22214a29ddd3bed005cbcc8f2aff7c61ef4940b 06-Oct-2014 Daniel Micay <danielmicay@gmail.com> Use regular arena allocation for huge tree nodes.

This avoids grabbing the base mutex, as a step towards fine-grained
locking for huge allocations. The thread cache also provides a tiny
(~3%) improvement for serial huge allocations.
/external/jemalloc/src/jemalloc.c
8bb3198f72fc7587dc93527f9f19fb5be52fa553 08-Oct-2014 Jason Evans <jasone@canonware.com> Refactor/fix arenas manipulation.

Abstract arenas access to use arena_get() (or a0get() where appropriate)
rather than directly reading e.g. arenas[ind]. Prior to the addition of
the arenas.extend mallctl, the worst possible outcome of directly
accessing arenas was a stale read, but arenas.extend may allocate and
assign a new array to arenas.

Add a tsd-based arenas_cache, which amortizes arenas reads. This
introduces some subtle bootstrapping issues, with tsd_boot() now being
split into tsd_boot[01]() to support tsd wrapper allocation
bootstrapping, as well as an arenas_cache_bypass tsd variable which
dynamically terminates allocation of arenas_cache itself.

Promote a0malloc(), a0calloc(), and a0free() to be generally useful for
internal allocation, and use them in several places (more may be
appropriate).

Abstract arena->nthreads management and fix a missing decrement during
thread destruction (recent tsd refactoring left arenas_cleanup()
unused).

Change arena_choose() to propagate OOM, and handle OOM in all callers.
This is important for providing consistent allocation behavior when the
MALLOCX_ARENA() flag is being used. Prior to this fix, it was possible
for an OOM to result in allocation silently allocating from a different
arena than the one specified.
/external/jemalloc/src/jemalloc.c
155bfa7da18cab0d21d87aa2dce4554166836f5d 06-Oct-2014 Jason Evans <jasone@canonware.com> Normalize size classes.

Normalize size classes to use the same number of size classes per size
doubling (currently hard coded to 4), across the intire range of size
classes. Small size classes already used this spacing, but in order to
support this change, additional small size classes now fill [4 KiB .. 16
KiB). Large size classes range from [16 KiB .. 4 MiB). Huge size
classes now support non-multiples of the chunk size in order to fill (4
MiB .. 16 MiB).
/external/jemalloc/src/jemalloc.c
0800afd03f6f4bc2d722bffedb3398d8ac762c5f 04-Oct-2014 Jason Evans <jasone@canonware.com> Silence a compiler warning.
/external/jemalloc/src/jemalloc.c
029d44cf8b22aa7b749747bfd585887fb59e0030 04-Oct-2014 Jason Evans <jasone@canonware.com> Fix tsd cleanup regressions.

Fix tsd cleanup regressions that were introduced in
5460aa6f6676c7f253bfcb75c028dfd38cae8aaf (Convert all tsd variables to
reside in a single tsd structure.). These regressions were twofold:

1) tsd_tryget() should never (and need never) return NULL. Rename it to
tsd_fetch() and simplify all callers.
2) tsd_*_set() must only be called when tsd is in the nominal state,
because cleanup happens during the nominal-->purgatory transition,
and re-initialization must not happen while in the purgatory state.
Add tsd_nominal() and use it as needed. Note that tsd_*{p,}_get()
can still be used as long as no re-initialization that would require
cleanup occurs. This means that e.g. the thread_allocated counter
can be updated unconditionally.
/external/jemalloc/src/jemalloc.c
fc12c0b8bc1160530d1e3e641b76d2a4f793136f 04-Oct-2014 Jason Evans <jasone@canonware.com> Implement/test/fix prof-related mallctl's.

Implement/test/fix the opt.prof_thread_active_init,
prof.thread_active_init, and thread.prof.active mallctl's.

Test/fix the thread.prof.name mallctl.

Refactor opt_prof_active to be read-only and move mutable state into the
prof_active variable. Stop leaning on ctl-related locking for
protection.
/external/jemalloc/src/jemalloc.c
551ebc43647521bdd0bc78558b106762b3388928 03-Oct-2014 Jason Evans <jasone@canonware.com> Convert to uniform style: cond == false --> !cond
/external/jemalloc/src/jemalloc.c
e3a16fce5eb0c62a49e751f156d040c9f77fbc23 24-Sep-2014 Dave Rigby <daver@couchbase.com> Mark malloc_conf as a weak symbol

This fixes issue #113 - je_malloc_conf is not respected on OS X
/external/jemalloc/src/jemalloc.c
5460aa6f6676c7f253bfcb75c028dfd38cae8aaf 23-Sep-2014 Jason Evans <jasone@canonware.com> Convert all tsd variables to reside in a single tsd structure.
/external/jemalloc/src/jemalloc.c
c3e9e7b0412e97e4976507f914fd39901b023537 12-Sep-2014 Jason Evans <jasone@canonware.com> Fix irallocx_prof() sample logic.

Fix irallocx_prof() sample logic to only update the threshold counter
after it knows what size the allocation ended up being. This regression
was caused by 6e73dc194ee9682d3eacaf725a989f04629718f7 (Fix a profile
sampling race.), which did not make it into any releases prior to this
fix.
/external/jemalloc/src/jemalloc.c
9c640bfdd4e2f25180a32ed3704ce8e4c4cc21f1 12-Sep-2014 Jason Evans <jasone@canonware.com> Apply likely()/unlikely() to allocation/deallocation fast paths.
/external/jemalloc/src/jemalloc.c
91566fc079cfaeaf2b424b7f40d6b9d8669d0470 11-Sep-2014 Jason Evans <je@fb.com> Fix mallocx() to always honor MALLOCX_ARENA() when profiling.
/external/jemalloc/src/jemalloc.c
23fdf8b359a690f457c5300338f4994d06402b95 09-Sep-2014 Daniel Micay <danielmicay@gmail.com> mark some conditions as unlikely

* assertion failure
* malloc_init failure
* malloc not already initialized (in malloc_init)
* running in valgrind
* thread cache disabled at runtime

Clang and GCC already consider a comparison with NULL or -1 to be cold,
so many branches (out-of-memory) are already correctly considered as
cold and marking them is not important.
/external/jemalloc/src/jemalloc.c
6e73dc194ee9682d3eacaf725a989f04629718f7 10-Sep-2014 Jason Evans <je@fb.com> Fix a profile sampling race.

Fix a profile sampling race that was due to preparing to sample, yet
doing nothing to assure that the context remains valid until the stats
are updated.

These regressions were caused by
602c8e0971160e4b85b08b16cf8a2375aa24bc04 (Implement per thread heap
profiling.), which did not make it into any releases prior to these
fixes.
/external/jemalloc/src/jemalloc.c
a2260c95cd717c06c28b61d40b2157254d594219 09-Sep-2014 Jason Evans <je@fb.com> Fix sdallocx() assertion.

Refactor sdallocx() and nallocx() to share inallocx(), and fix an
sdallocx() assertion to check usize rather than size.
/external/jemalloc/src/jemalloc.c
4cfe55166e0173be745c53adb0fecf50d11d1227 28-Aug-2014 Daniel Micay <danielmicay@gmail.com> Add support for sized deallocation.

This adds a new `sdallocx` function to the external API, allowing the
size to be passed by the caller. It avoids some extra reads in the
thread cache fast path. In the case where stats are enabled, this
avoids the work of calculating the size from the pointer.

An assertion validates the size that's passed in, so enabling debugging
will allow users of the API to debug cases where an incorrect size is
passed in.

The performance win for a contrived microbenchmark doing an allocation
and immediately freeing it is ~10%. It may have a different impact on a
real workload.

Closes #28
/external/jemalloc/src/jemalloc.c
b718cf77e9917f6ae1995c2e2b219ff4219c9f46 07-Sep-2014 Jason Evans <je@fb.com> Optimize [nmd]alloc() fast paths.

Optimize [nmd]alloc() fast paths such that the (flags == 0) case is
streamlined, flags decoding only happens to the minimum degree
necessary, and no conditionals are repeated.
/external/jemalloc/src/jemalloc.c
3e24afa28e01b743a9f7fa1d42acb67e079d8187 18-Aug-2014 Sara Golemon <sgolemon@fb.com> Test for availability of malloc hooks via autoconf

__*_hook() is glibc, but on at least one glibc platform (homebrew),
the __GLIBC__ define isn't set correctly and we miss being able to
use these hooks.

Do a feature test for it during configuration so that we enable it
anywhere the hooks are actually available.
/external/jemalloc/src/jemalloc.c
602c8e0971160e4b85b08b16cf8a2375aa24bc04 19-Aug-2014 Jason Evans <jasone@canonware.com> Implement per thread heap profiling.

Rename data structures (prof_thr_cnt_t-->prof_tctx_t,
prof_ctx_t-->prof_gctx_t), and convert to storing a prof_tctx_t for
sampled objects.

Convert PROF_ALLOC_PREP() to prof_alloc_prep(), since precise backtrace
depth within jemalloc functions is no longer an issue (pprof prunes
irrelevant frames).

Implement mallctl's:
- prof.reset implements full sample data reset, and optional change of
sample interval.
- prof.lg_sample reads the current sample interval (opt.lg_prof_sample
was the permanent source of truth prior to prof.reset).
- thread.prof.name provides naming capability for threads within heap
profile dumps.
- thread.prof.active makes it possible to activate/deactivate heap
profiling for individual threads.

Modify the heap dump files to contain per thread heap profile data.
This change is incompatible with the existing pprof, which will require
enhancements to read and process the enriched data.
/external/jemalloc/src/jemalloc.c
94ed6812bc04a6171d1a801f2740355f458d5c9c 29-May-2014 Richard Diamond <wichard@vitalitystudios.com> Don't catch fork()ing events for Native Client.

Native Client doesn't allow forking, thus there is no need to catch
fork()ing events for Native Client.

Additionally, without this commit, jemalloc will introduce an unresolved
pthread_atfork() in PNaCl Rust bins.
/external/jemalloc/src/jemalloc.c
e2deab7a751c8080c2b2cdcfd7b11887332be1bb 16-May-2014 Jason Evans <je@fb.com> Refactor huge allocation to be managed by arenas.

Refactor huge allocation to be managed by arenas (though the global
red-black tree of huge allocations remains for lookup during
deallocation). This is the logical conclusion of recent changes that 1)
made per arena dss precedence apply to huge allocation, and 2) made it
possible to replace the per arena chunk allocation/deallocation
functions.

Remove the top level huge stats, and replace them with per arena huge
stats.

Normalize function names and types to *dalloc* (some were *dealloc*).

Remove the --enable-mremap option. As jemalloc currently operates, this
is a performace regression for some applications, but planned work to
logarithmically space huge size classes should provide similar amortized
performance. The motivation for this change was that mremap-based huge
reallocation forced leaky abstractions that prevented refactoring.
/external/jemalloc/src/jemalloc.c
fb7fe50a88ca9bde74e9a401ae17ad3b15bbae28 06-May-2014 aravind <aravind@fb.com> Add support for user-specified chunk allocators/deallocators.

Add new mallctl endpoints "arena<i>.chunk.alloc" and
"arena<i>.chunk.dealloc" to allow userspace to configure
jemalloc's chunk allocator and deallocator on a per-arena
basis.
/external/jemalloc/src/jemalloc.c
a344dd01c74a7e385087819046105f689931905d 02-May-2014 Jason Evans <je@fb.com> Fix coding sytle nits.
/external/jemalloc/src/jemalloc.c
6f001059aa33d77a3cb7799002044faf8dd08fc0 23-Apr-2014 Jason Evans <jasone@canonware.com> Simplify backtracing.

Simplify backtracing to not ignore any frames, and compensate for this
in pprof in order to increase flexibility with respect to function-based
refactoring even in the presence of non-deterministic inlining. Modify
pprof to blacklist all jemalloc allocation entry points including
non-standard ones like mallocx(), and ignore all allocator-internal
frames. Prior to this change, pprof excluded the specifically
blacklisted functions from backtraces, but it left allocator-internal
frames intact.
/external/jemalloc/src/jemalloc.c
bd87b01999416ec7418ff8bdb504d9b6c009ff68 16-Apr-2014 Jason Evans <je@fb.com> Optimize Valgrind integration.

Forcefully disable tcache if running inside Valgrind, and remove
Valgrind calls in tcache-specific code.

Restructure Valgrind-related code to move most Valgrind calls out of the
fast path functions.

Take advantage of static knowledge to elide some branches in
JEMALLOC_VALGRIND_REALLOC().
/external/jemalloc/src/jemalloc.c
ecd3e59ca351d7111ec72a327fe0c009f2aa69a0 15-Apr-2014 Jason Evans <je@fb.com> Remove the "opt.valgrind" mallctl.

Remove the "opt.valgrind" mallctl because it is unnecessary -- jemalloc
automatically detects whether it is running inside valgrind.
/external/jemalloc/src/jemalloc.c
9790b9667fd975b1f9a4f108f9d0a20ab265c6b6 15-Apr-2014 Jason Evans <jasone@canonware.com> Remove the *allocm() API, which is superceded by the *allocx() API.
/external/jemalloc/src/jemalloc.c
9b0cbf0850b130a9b0a8c58bd10b2926b2083510 11-Apr-2014 Jason Evans <je@fb.com> Remove support for non-prof-promote heap profiling metadata.

Make promotion of sampled small objects to large objects mandatory, so
that profiling metadata can always be stored in the chunk map, rather
than requiring one pointer per small region in each small-region page
run. In practice the non-prof-promote code was only useful when using
jemalloc to track all objects and report them as leaks at program exit.
However, Valgrind is at least as good a tool for this particular use
case.

Furthermore, the non-prof-promote code is getting in the way of
some optimizations that will make heap profiling much cheaper for the
predominant use case (sampling a small representative proportion of all
allocations).
/external/jemalloc/src/jemalloc.c
be8e59f5a64ef775c9694aee0d6a87d92336d303 06-Apr-2014 Ben Maurer <bmaurer@fb.com> Don't dereference chunk->arena in free() hot path

When you call free() we load chunk->arena even though that
data isn't used on the tcache hot path.

In profiling some FB applications, I found that ~30% of the
dTLB misses in the free() function come from this line. With
4 MB chunks, the arena_chunk_t->map is ~ 32 KB (1024 pages
in the chunk, 4 8 byte pointers in arena_chunk_map_t). This
means there's only a 1/8 chance of the page containing
chunk->arena also comtaining the map bits.
/external/jemalloc/src/jemalloc.c
fbb31029a5c2f556f39e04a8781340d4ee4cf16c 27-Mar-2014 Max Wang <mwang@fb.com> Use arena dss prec instead of default for huge allocs.

Pass a dss_prec_t parameter to huge_{m,p,r}alloc instead of defaulting
to the chunk dss prec.
/external/jemalloc/src/jemalloc.c
e2206edebcce662e3979c68ba182d0bcf38141ba 21-Jan-2014 Jason Evans <jasone@canonware.com> Fix unused variable warnings.
/external/jemalloc/src/jemalloc.c
b2c31660be917ea6d59cd54e6f650b06b5e812ed 13-Jan-2014 Jason Evans <je@fb.com> Extract profiling code from [re]allocation functions.

Extract profiling code from malloc(), imemalign(), calloc(), realloc(),
mallocx(), rallocx(), and xallocx(). This slightly reduces the amount
of code compiled into the fast paths, but the primary benefit is the
combinatorial complexity reduction.

Simplify iralloc[t]() by creating a separate ixalloc() that handles the
no-move cases.

Further simplify [mrxn]allocx() (and by implication [mrn]allocm()) to
make request size overflows due to size class and/or alignment
constraints trigger undefined behavior (detected by debug-only
assertions).

Report ENOMEM rather than EINVAL if an OOM occurs during heap profiling
backtrace creation in imemalign(). This bug impacted posix_memalign()
and aligned_alloc().
/external/jemalloc/src/jemalloc.c
040531292147e8e4847d6c666746a426403d0cf5 21-Dec-2013 Jason Evans <je@fb.com> Fix an uninitialized variable read in xallocx().
/external/jemalloc/src/jemalloc.c
665769357cd77b74e00a146f196fff19243b33c4 16-Dec-2013 Jason Evans <jasone@canonware.com> Optimize arena_prof_ctx_set().

Refactor such that arena_prof_ctx_set() receives usize as an argument,
and use it to determine whether to handle ptr as a small region, rather
than reading the chunk page map.
/external/jemalloc/src/jemalloc.c
d82a5e6a34f20698ab9368bb2b4953b81d175552 13-Dec-2013 Jason Evans <jasone@canonware.com> Implement the *allocx() API.

Implement the *allocx() API, which is a successor to the *allocm() API.
The *allocx() functions are slightly simpler to use because they have
fewer parameters, they directly return the results of primary interest,
and mallocx()/rallocx() avoid the strict aliasing pitfall that
allocm()/rallocx() share with posix_memalign(). The following code
violates strict aliasing rules:

foo_t *foo;
allocm((void **)&foo, NULL, 42, 0);

whereas the following is safe:

foo_t *foo;
void *p;
allocm(&p, NULL, 42, 0);
foo = (foo_t *)p;

mallocx() does not have this problem:

foo_t *foo = (foo_t *)mallocx(42, 0);
/external/jemalloc/src/jemalloc.c
736923254409aed1a4a226e0ba7429f573c1f372 10-Dec-2013 Jason Evans <je@fb.com> Silence some unused variable warnings.
/external/jemalloc/src/jemalloc.c
52b30691f9a98fe7c8c59d587eb6285a3bacaabc 03-Dec-2013 Jason Evans <je@fb.com> Remove unused variable.
/external/jemalloc/src/jemalloc.c
addad093f887cecddd462b7130125a0e08060e1f 30-Nov-2013 Jason Evans <jasone@canonware.com> Clean up malloc_ncpus().

Clean up malloc_ncpus() by replacing incorrectly indented if..else
branches with a ?: expression.

Submitted by Igor Podlesny.
/external/jemalloc/src/jemalloc.c
39e7fd0580a140912fa1170de7a7699c86afe45d 26-Nov-2013 Jason Evans <je@fb.com> Fix ALLOCM_ARENA(a) handling in rallocm().

Fix rallocm() to use the specified arena for allocation, not just
deallocation.

Clarify ALLOCM_ARENA(a) documentation.
/external/jemalloc/src/jemalloc.c
ac4403cacb225c0cf2c926179af39c21bd7bfc3a 21-Oct-2013 Leonard Crestez <lcrestez@ixiacom.com> Delay pthread_atfork registering.

This function causes recursive allocation on LinuxThreads.

Signed-off-by: Crestez Dan Leonard <lcrestez@ixiacom.com>
/external/jemalloc/src/jemalloc.c
1d1cee127aebc6ca25207435ddc6ae5d9bb90d41 22-Oct-2013 Jason Evans <je@fb.com> Add a missing mutex unlock in malloc_init_hard() error path.

Add a missing mutex unlock in a malloc_init_hard() error path (failed
mutex initialization). In practice this bug was very unlikely to ever
trigger, but if it did, application deadlock would likely result.

Reported by Pat Lynch.
/external/jemalloc/src/jemalloc.c
e2985a23819670866c041ba07964099eeb9e0e07 22-Oct-2013 Jason Evans <je@fb.com> Avoid (x < 0) comparison for unsigned x.

Avoid (min < 0) comparison for unsigned min in malloc_conf_init(). This
bug had no practical consequences.

Reported by Pat Lynch.
/external/jemalloc/src/jemalloc.c
6556e28be15d9acd8f3835fb9fad90145e1edbff 21-Oct-2013 Jason Evans <je@fb.com> Prefer not_reached() over assert(false) where appropriate.
/external/jemalloc/src/jemalloc.c
543abf7e6c7de06fe9654e91190b5c44a11b065e 20-Oct-2013 Jason Evans <jasone@canonware.com> Fix inlining warning.

Add the JEMALLOC_ALWAYS_INLINE_C macro and use it for always-inlined
functions declared in .c files. This fixes a function attribute
inconsistency for debug builds that resulted in (harmless) compiler
warnings about functions not being inlinable.

Reported by Ricardo Nabinger Sanchez.
/external/jemalloc/src/jemalloc.c
dd6ef0302f3980200ed602ec600e211f55e58694 20-Sep-2013 Alexandre Perrin <alex@kaworu.ch> malloc_conf_init: revert errno value when readlink(2) fail.
/external/jemalloc/src/jemalloc.c
88c222c8e91499bf5d3fba53b24222df0cda5771 06-Feb-2013 Jason Evans <je@fb.com> Fix a prof-related locking order bug.

Fix a locking order bug that could cause deadlock during fork if heap
profiling were enabled.
/external/jemalloc/src/jemalloc.c
bbe29d374d0fa5f4684621f16c099294e56c26ef 31-Jan-2013 Jason Evans <je@fb.com> Fix potential TLS-related memory corruption.

Avoid writing to uninitialized TLS as a side effect of deallocation.
Initializing TLS during deallocation is unsafe because it is possible
that a thread never did any allocation, and that TLS has already been
deallocated by the threads library, resulting in write-after-free
corruption. These fixes affect prof_tdata and quarantine; all other
uses of TLS are already safe, whether intentionally (as for tcache) or
unintentionally (as for arenas).
/external/jemalloc/src/jemalloc.c
d1b6e18a99caf7e0c38707f4aed7ec8c492e0424 23-Jan-2013 Jason Evans <je@fb.com> Revert opt_abort and opt_junk refactoring.

Revert refactoring of opt_abort and opt_junk declarations. clang
accepts the config_*-based declarations (and generates correct code),
but gcc complains with:

error: initializer element is not constant
/external/jemalloc/src/jemalloc.c
ba175a2bfb236d79404012d9b5bb6e9b3c8be8dd 22-Jan-2013 Jason Evans <jasone@canonware.com> Use config_* instead of JEMALLOC_*.

Convert a couple of stragglers from JEMALLOC_* to use config_*.
/external/jemalloc/src/jemalloc.c
88393cb0eb9a046000d20809809d4adac11957ab 22-Jan-2013 Jason Evans <jasone@canonware.com> Add and use JEMALLOC_ALWAYS_INLINE.

Add JEMALLOC_ALWAYS_INLINE and use it to guarantee that the entire fast
paths of the primary allocation/deallocation functions are inlined.
/external/jemalloc/src/jemalloc.c
6e6164ae159d9c3bd4f44bd2cba6fc3237687c80 03-Dec-2012 Garrett Cooper <yanegomi@gmail.com> Don't mangle errno with free(3) if utrace(2) fails

This ensures POLA on FreeBSD (at least) as free(3) is generally assumed
to not fiddle around with errno.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
/external/jemalloc/src/jemalloc.c
1bf2743e08ba66cc141e296812839947223e4370 23-Dec-2012 Jason Evans <jasone@canonware.com> Add clipping support to lg_chunk option processing.

Modify processing of the lg_chunk option so that it clips an
out-of-range input to the edge of the valid range. This makes it
possible to request the minimum possible chunk size without intimate
knowledge of allocator internals.

Submitted by Ian Lepore (see FreeBSD PR bin/174641).
/external/jemalloc/src/jemalloc.c
609ae595f0358157b19311b0f9f9591db7cee705 11-Oct-2012 Jason Evans <je@fb.com> Add arena-specific and selective dss allocation.

Add the "arenas.extend" mallctl, so that it is possible to create new
arenas that are outside the set that jemalloc automatically multiplexes
threads onto.

Add the ALLOCM_ARENA() flag for {,r,d}allocm(), so that it is possible
to explicitly allocate from a particular arena.

Add the "opt.dss" mallctl, which controls the default precedence of dss
allocation relative to mmap allocation.

Add the "arena.<i>.dss" mallctl, which makes it possible to set the
default dss precedence on a per arena or global basis.

Add the "arena.<i>.purge" mallctl, which obsoletes "arenas.purge".

Add the "stats.arenas.<i>.dss" mallctl.
/external/jemalloc/src/jemalloc.c
2cc11ff83748be63302b0289a3abb1d86e1e437f 10-Oct-2012 Jason Evans <je@fb.com> Make malloc_usable_size() implementation consistent with prototype.

Use JEMALLOC_USABLE_SIZE_CONST for the malloc_usable_size()
implementation as well as the prototype, for consistency's sake.
/external/jemalloc/src/jemalloc.c
b5225928fe106a7d809bd34e849abcd6941e93c7 10-Oct-2012 Jason Evans <je@fb.com> Fix fork(2)-related mutex acquisition order.

Fix mutex acquisition order inversion for the chunks rtree and the base
mutex. Chunks rtree acquisition was introduced by the previous commit,
so this bug was short-lived.
/external/jemalloc/src/jemalloc.c
20f1fc95adb35ea63dc61f47f2b0ffbd37d39f32 09-Oct-2012 Jason Evans <je@fb.com> Fix fork(2)-related deadlocks.

Add a library constructor for jemalloc that initializes the allocator.
This fixes a race that could occur if threads were created by the main
thread prior to any memory allocation, followed by fork(2), and then
memory allocation in the child process.

Fix the prefork/postfork functions to acquire/release the ctl, prof, and
rtree mutexes. This fixes various fork() child process deadlocks, but
one possible deadlock remains (intentionally) unaddressed: prof
backtracing can acquire runtime library mutexes, so deadlock is still
possible if heap profiling is enabled during fork(). This deadlock is
known to be a real issue in at least the case of libgcc-based
backtracing.

Reported by tfengjun.
/external/jemalloc/src/jemalloc.c
1d553f72cbbcbacc1802d2cc96a4024315e616b3 26-Sep-2012 Corey Richardson <corey@octayn.net> If sysconf() fails, the number of CPUs is reported as UINT_MAX, not 1 as it should be
/external/jemalloc/src/jemalloc.c
5c710cee783a44061fa2c467ffd8984b8047b90e 24-May-2012 Jason Evans <je@fb.com> Remove const from __*_hook variable declarations.

Remove const from __*_hook variable declarations, so that glibc can
modify them during process forking.
/external/jemalloc/src/jemalloc.c
174b70efb4942be112b1ea38db1e5c6ca7599e5d 16-May-2012 Jason Evans <je@fb.com> Disable tcache by default if running inside Valgrind.

Disable tcache by default if running inside Valgrind, in order to avoid
making unallocated objects appear reachable to Valgrind.
/external/jemalloc/src/jemalloc.c
781fe75e0a03f13bc1f5403acbbf87796ceea1dc 15-May-2012 Jason Evans <je@fb.com> Auto-detect whether running inside Valgrind.

Auto-detect whether running inside Valgrind, thus removing the need to
manually specify MALLOC_CONF=valgrind:true.
/external/jemalloc/src/jemalloc.c
58ad1e4956affe0f9949445dce4410ad70b4cdac 12-May-2012 Jason Evans <jasone@canonware.com> Return early in _malloc_{pre,post}fork() if uninitialized.

Avoid mutex operations in _malloc_{pre,post}fork() unless jemalloc has
been initialized.

Reported by David Xu.
/external/jemalloc/src/jemalloc.c
fd97b1dfc76647c3f90f28dc63cc987041fe20df 30-Apr-2012 Mike Hommey <mh@glandium.org> Add support for MSVC

Tested with MSVC 8 32 and 64 bits.
/external/jemalloc/src/jemalloc.c
da99e31105eb709ef4ec8a120b115c32a6b9723a 30-Apr-2012 Mike Hommey <mh@glandium.org> Replace JEMALLOC_ATTR with various different macros when it makes sense

Theses newly added macros will be used to implement the equivalent under
MSVC. Also, move the definitions to headers, where they make more sense,
and for some, are even more useful there (e.g. malloc).
/external/jemalloc/src/jemalloc.c
a14bce85e885f83c96116cc5438ae52d740f3727 30-Apr-2012 Mike Hommey <mh@glandium.org> Use Get/SetLastError on Win32

Using errno on win32 doesn't quite work, because the value set in a shared
library can't be read from e.g. an executable calling the function setting
errno.

At the same time, since buferror always uses errno/GetLastError, don't pass
it.
/external/jemalloc/src/jemalloc.c
3fb50b0407ff7dfe14727995706e2b42836f0f7e 25-Apr-2012 Jason Evans <je@fb.com> Fix a PROF_ALLOC_PREP() error path.

Fix a PROF_ALLOC_PREP() error path to initialize the return value to
NULL.
/external/jemalloc/src/jemalloc.c
8694e2e7b901eb3254a7da2461709ba2ce135aba 23-Apr-2012 Jason Evans <je@fb.com> Silence compiler warnings.
/external/jemalloc/src/jemalloc.c
a19e87fbad020e8dd3d26682032929e8e5ae71c1 22-Apr-2012 Mike Hommey <mh@glandium.org> Add support for Mingw
/external/jemalloc/src/jemalloc.c
a8f8d7540d66ddee7337db80c92890916e1063ca 22-Apr-2012 Jason Evans <jasone@canonware.com> Remove mmap_unaligned.

Remove mmap_unaligned, which was used to heuristically decide whether to
optimistically call mmap() in such a way that could reduce the total
number of system calls. If I remember correctly, the intention of
mmap_unaligned was to avoid always executing the slow path in the
presence of ASLR. However, that reasoning seems to have been based on a
flawed understanding of how ASLR actually works. Although ASLR
apparently causes mmap() to ignore address requests, it does not cause
total placement randomness, so there is a reasonable expectation that
iterative mmap() calls will start returning chunk-aligned mappings once
the first chunk has been properly aligned.
/external/jemalloc/src/jemalloc.c
606f1fdc3cdbc700717133ca56685313caea24bb 21-Apr-2012 Jason Evans <jasone@canonware.com> Put CONF_HANDLE_*() keys in quotes.

Put CONF_HANDLE_*() keys in quotes, so that they aren't mangled when
--with-private-namespace is used.
/external/jemalloc/src/jemalloc.c
86e58583bb443fcfe885a1a96b466ab5933cb443 19-Apr-2012 Jason Evans <jasone@canonware.com> Make special FreeBSD function overrides visible.

Make special FreeBSD libc/libthr function overrides for
_malloc_prefork(), _malloc_postfork(), and _malloc_thread_cleanup()
visible.
/external/jemalloc/src/jemalloc.c
0b25fe79aaf8840a5acda7e3160a053d42349872 18-Apr-2012 Jason Evans <je@fb.com> Update prof defaults to match common usage.

Change the "opt.lg_prof_sample" default from 0 to 19 (1 B to 512 KiB).

Change the "opt.prof_accum" default from true to false.

Add the "opt.prof_final" mallctl, so that "opt.prof_prefix" need not be
abused to disable final profile dumping.
/external/jemalloc/src/jemalloc.c
7ca0fdfb85b2a9fc7a112e158892c098e004385b 13-Apr-2012 Jason Evans <je@fb.com> Disable munmap() if it causes VM map holes.

Add a configure test to determine whether common mmap()/munmap()
patterns cause VM map holes, and only use munmap() to discard unused
chunks if the problem does not exist.

Unify the chunk caching for mmap and dss.

Fix options processing to limit lg_chunk to be large enough that
redzones will always fit.
/external/jemalloc/src/jemalloc.c
d6abcbb14b8d1c8beb1c61bfc5a24cb54578b85c 13-Apr-2012 Jason Evans <jasone@canonware.com> Always disable redzone by default.

Always disable redzone by default, even when --enable-debug is
specified. The memory overhead for redzones can be substantial, which
makes this feature something that should only be opted into.
/external/jemalloc/src/jemalloc.c
b8325f9cb031285585567cdeb1338aeca4185f6c 12-Apr-2012 Mike Hommey <mh@glandium.org> Call base_boot before chunk_boot0

Chunk_boot0 calls rtree_new, which calls base_alloc, which locks the
base_mtx mutex. That mutex is initialized in base_boot.
/external/jemalloc/src/jemalloc.c
5ff709c264e52651de25b788692c62ff1f6f389c 12-Apr-2012 Jason Evans <jasone@canonware.com> Normalize aligned allocation algorithms.

Normalize arena_palloc(), chunk_alloc_mmap_slow(), and
chunk_recycle_dss() to use the same algorithm for trimming
over-allocation.

Add the ALIGNMENT_ADDR2BASE(), ALIGNMENT_ADDR2OFFSET(), and
ALIGNMENT_CEILING() macros, and use them where appropriate.

Remove the run_size_p parameter from sa2u().

Fix a potential deadlock in chunk_recycle_dss() that was introduced by
eae269036c9f702d9fa9be497a1a2aa1be13a29e (Add alignment support to
chunk_alloc()).
/external/jemalloc/src/jemalloc.c
122449b073bcbaa504c4f592ea2d733503c272d2 06-Apr-2012 Jason Evans <je@fb.com> Implement Valgrind support, redzones, and quarantine.

Implement Valgrind support, as well as the redzone and quarantine
features, which help Valgrind detect memory errors. Redzones are only
implemented for small objects because the changes necessary to support
redzones around large and huge objects are complicated by in-place
reallocation, to the point that it isn't clear that the maintenance
burden is worth the incremental improvement to Valgrind support.

Merge arena_salloc() and arena_salloc_demote().

Refactor i[v]salloc() to expose the 'demote' option.
/external/jemalloc/src/jemalloc.c
a1ee7838e14b321a97bfacb1f1cf5004198f2203 11-Apr-2012 Jason Evans <je@fb.com> Rename labels.

Rename labels from FOO to label_foo in order to avoid system macro
definitions, in particular OUT and ERROR on mingw.

Reported by Mike Hommey.
/external/jemalloc/src/jemalloc.c
b147611b5253921a873191bb0589d3b18f613946 05-Apr-2012 Jason Evans <jasone@canonware.com> Add utrace(2)-based tracing (--enable-utrace).
/external/jemalloc/src/jemalloc.c
02b231205e802a7c4f33899a569adcb1312a85d5 05-Apr-2012 Jason Evans <je@fb.com> Fix threaded initialization and enable it on Linux.

Reported by Mike Hommey.
/external/jemalloc/src/jemalloc.c
01b3fe55ff3ac8e4aa689f09fcb0729da8037638 03-Apr-2012 Jason Evans <jasone@canonware.com> Add a0malloc(), a0calloc(), and a0free().

Add a0malloc(), a0calloc(), and a0free(), which are used by FreeBSD's
libc to allocate/deallocate TLS in static binaries.
/external/jemalloc/src/jemalloc.c
633aaff96787db82c06d35baf012de197a1a1902 03-Apr-2012 Jason Evans <jasone@canonware.com> Postpone mutex initialization on FreeBSD.

Postpone mutex initialization on FreeBSD until after base allocation is
safe.
/external/jemalloc/src/jemalloc.c
ae4c7b4b4092906c641d69b4bf9fcb4a7d50790d 02-Apr-2012 Jason Evans <jasone@canonware.com> Clean up *PAGE* macros.

s/PAGE_SHIFT/LG_PAGE/g and s/PAGE_SIZE/PAGE/g.

Remove remnants of the dynamic-page-shift code.

Rename the "arenas.pagesize" mallctl to "arenas.page".

Remove the "arenas.chunksize" mallctl, which is redundant with
"opt.lg_chunk".
/external/jemalloc/src/jemalloc.c
f0047372673da7f213f733465dab0d8825eb1c9f 03-Apr-2012 Jason Evans <jasone@canonware.com> Revert "Avoid NULL check in free() and malloc_usable_size()."

This reverts commit 96d4120ac08db3f2d566e8e5c3bc134a24aa0afc.

ivsalloc() depends on chunks_rtree being initialized. This can be
worked around via a NULL pointer check. However,
thread_allocated_tsd_get() also depends on initialization having
occurred, and there is no way to guard its call in free() that is
cheaper than checking whether ptr is NULL.
/external/jemalloc/src/jemalloc.c
96d4120ac08db3f2d566e8e5c3bc134a24aa0afc 02-Apr-2012 Jason Evans <jasone@canonware.com> Avoid NULL check in free() and malloc_usable_size().

Generalize isalloc() to handle NULL pointers in such a way that the NULL
checking overhead is only paid when introspecting huge allocations (or
NULL). This allows free() and malloc_usable_size() to no longer check
for NULL.

Submitted by Igor Bukanov and Mike Hommey.
/external/jemalloc/src/jemalloc.c
80b25932ca52e9506d4e2b8ee0fa58aa5ae3306d 02-Apr-2012 Mike Hommey <mh@glandium.org> Move last bit of zone initialization in zone.c, and lazy-initialize
/external/jemalloc/src/jemalloc.c
4eeb52f080edb1f4b518249388f6c617386c00e5 02-Apr-2012 Jason Evans <jasone@canonware.com> Remove vsnprintf() and strtoumax() validation.

Remove code that validates malloc_vsnprintf() and malloc_strtoumax()
against their namesakes. The validation code has adequately served its
usefulness at this point, and it isn't worth dealing with the different
formatting for %p with glibc versus other implementations for NULL
pointers ("(nil)" vs. "0x0").

Reported by Mike Hommey.
/external/jemalloc/src/jemalloc.c
3c2ba0dcbc2f4896a892fad84d5dcf5bd4c30a81 27-Mar-2012 Mike Hommey <mh@glandium.org> Avoid crashes when system libraries use the purgeable zone allocator
/external/jemalloc/src/jemalloc.c
71a93b8725fb52ae393ab88e2fccd5afa84c66a0 27-Mar-2012 Mike Hommey <mh@glandium.org> Move zone registration to zone.c
/external/jemalloc/src/jemalloc.c
e77fa59ece7e23de586f08980f627b8102511755 28-Mar-2012 Mike Hommey <mh@glandium.org> Don't use pthread_atfork to register prefork/postfork handlers on OSX

OSX libc calls zone allocators' force_lock/force_unlock already.
/external/jemalloc/src/jemalloc.c
2465bdf4937ffba309e7289014443c6b51566f22 26-Mar-2012 Jason Evans <jasone@canonware.com> Check for NULL ptr in malloc_usable_size().

Check for NULL ptr in malloc_usable_size(), rather than just asserting
that ptr is non-NULL. This matches behavior of other implementations
(e.g., glibc and tcmalloc).
/external/jemalloc/src/jemalloc.c
5c89c50d1803dc0fb6544c1abd40552e76c8614d 26-Mar-2012 Mike Hommey <mh@glandium.org> Fix glibc hooks when using both --with-jemalloc-prefix and --with-mangling
/external/jemalloc/src/jemalloc.c
41b6afb834b1f5250223678c52bd4f013d4234f6 03-Feb-2012 Jason Evans <jasone@canonware.com> Port to FreeBSD.

Use FreeBSD-specific functions (_pthread_mutex_init_calloc_cb(),
_malloc_{pre,post}fork()) to avoid bootstrapping issues due to
allocation in libc and libthr.

Add malloc_strtoumax() and use it instead of strtoul(). Disable
validation code in malloc_vsnprintf() and malloc_strtoumax() until
jemalloc is initialized. This is necessary because locale
initialization causes allocation for both vsnprintf() and strtoumax().

Force the lazy-lock feature on in order to avoid pthread_self(),
because it causes allocation.

Use syscall(SYS_write, ...) rather than write(...), because libthr wraps
write() and causes allocation. Without this workaround, it would not be
possible to print error messages in malloc_conf_init() without
substantially reworking bootstrapping.

Fix choose_arena_hard() to look at how many threads are assigned to the
candidate choice, rather than checking whether the arena is
uninitialized. This bug potentially caused more arenas to be
initialized than necessary.
/external/jemalloc/src/jemalloc.c
6da5418ded9170b087c35960e0010006430117c1 24-Mar-2012 Jason Evans <je@fb.com> Remove ephemeral mutexes.

Remove ephemeral mutexes from the prof machinery, and remove
malloc_mutex_destroy(). This simplifies mutex management on systems
that call malloc()/free() inside pthread_mutex_{create,destroy}().

Add atomic_*_u() for operation on unsigned values.

Fix prof_printf() to call malloc_vsnprintf() rather than
malloc_snprintf().
/external/jemalloc/src/jemalloc.c
9225a1991a58190207cca2ff3cdba966bb322dd5 23-Mar-2012 Jason Evans <je@fb.com> Add JEMALLOC_CC_SILENCE_INIT().

Add JEMALLOC_CC_SILENCE_INIT(), which provides succinct syntax for
initializing a variable to avoid a spurious compiler warning.
/external/jemalloc/src/jemalloc.c
cd9a1346e96f71bdecdc654ea50fc62d76371e74 22-Mar-2012 Jason Evans <je@fb.com> Implement tsd.

Implement tsd, which is a TLS/TSD abstraction that uses one or both
internally. Modify bootstrapping such that no tsd's are utilized until
allocation is safe.

Remove malloc_[v]tprintf(), and use malloc_snprintf() instead.

Fix %p argument size handling in malloc_vsnprintf().

Fix a long-standing statistics-related bug in the "thread.arena"
mallctl that could cause crashes due to linked list corruption.
/external/jemalloc/src/jemalloc.c
154829d2560a202ef6378b089655747585e44fb5 20-Mar-2012 Mike Hommey <mh@glandium.org> Improve zone support for OSX

I tested a build from 10.7 run on 10.7 and 10.6, and a build from 10.6
run on 10.6. The AC_COMPILE_IFELSE limbo is to avoid running a program
during configure, which presumably makes it work when cross compiling
for iOS.
/external/jemalloc/src/jemalloc.c
e24c7af35d1e9d24d02166ac98cfca7cf807ff13 19-Mar-2012 Jason Evans <je@fb.com> Invert NO_TLS to JEMALLOC_TLS.
/external/jemalloc/src/jemalloc.c
4e2e3dd9cf19ed5991938a708a8b50611aa5bbf8 14-Mar-2012 Jason Evans <je@fb.com> Fix fork-related bugs.

Acquire/release arena bin locks as part of the prefork/postfork. This
bug made deadlock in the child between fork and exec a possibility.

Split jemalloc_postfork() into jemalloc_postfork_{parent,child}() so
that the child can reinitialize mutexes rather than unlocking them. In
practice, this bug tended not to cause problems.
/external/jemalloc/src/jemalloc.c
0a0bbf63e5d9bc60d6854c6d46b437fbeebd1470 13-Mar-2012 Jason Evans <je@fb.com> Implement aligned_alloc().

Implement aligned_alloc(), which was added in the C11 standard. The
function is weakly specified to the point that a minimally compliant
implementation would be painful to use (size must be an integral
multiple of alignment!), which in practice makes posix_memalign() a
safer choice.
/external/jemalloc/src/jemalloc.c
4c2faa8a7c42a47a6bea509f5a23234bc5a66d40 13-Mar-2012 Jason Evans <je@fb.com> Fix a regression in JE_COMPILABLE().

Revert JE_COMPILABLE() so that it detects link errors. Cross-compiling
should still work as long as a valid configure cache is provided.

Clean up some comments/whitespace.
/external/jemalloc/src/jemalloc.c
d81e4bdd5c991bd5642c8b859ef1f752b51cd9be 06-Mar-2012 Jason Evans <je@fb.com> Implement malloc_vsnprintf().

Implement malloc_vsnprintf() (a subset of vsnprintf(3)) as well as
several other printing functions based on it, so that formatted printing
can be relied upon without concern for inducing a dependency on floating
point runtime support. Replace malloc_write() calls with
malloc_*printf() where doing so simplifies the code.

Add name mangling for library-private symbols in the data and BSS
sections. Adjust CONF_HANDLE_*() macros in malloc_conf_init() to expose
all opt_* variable use to cpp so that proper mangling occurs.
/external/jemalloc/src/jemalloc.c
4507f34628dfae26e6b0a6faa13e5f9a49600616 05-Mar-2012 Jason Evans <je@fb.com> Remove the lg_tcache_gc_sweep option.

Remove the lg_tcache_gc_sweep option, because it is no longer
very useful. Prior to the addition of dynamic adjustment of tcache fill
count, it was possible for fill/flush overhead to be a problem, but this
problem no longer occurs.
/external/jemalloc/src/jemalloc.c
7e77eaffffe5c73d44ee64b14ba4b3d7693179d6 03-Mar-2012 Jason Evans <je@fb.com> Add the --disable-experimental option.
/external/jemalloc/src/jemalloc.c
0a5489e37da88a1a50fbf8552e0d3a7f8fd93ffc 02-Mar-2012 Jason Evans <je@fb.com> Add --with-mangling.

Add the --with-mangling configure option, which can be used to specify
name mangling on a per public symbol basis that takes precedence over
--with-jemalloc-prefix.

Expose the memalign() and valloc() overrides even if
--with-jemalloc-prefix is specified. This change does no real harm, and
simplifies the code.
/external/jemalloc/src/jemalloc.c
7e15dab94d3f008b0a6c296ad7afec9ed47ff1ac 29-Feb-2012 Jason Evans <je@fb.com> Add nallocm().

Add nallocm(), which computes the real allocation size that would result
from the corresponding allocm() call. nallocm() is a functional
superset of OS X's malloc_good_size(), in that it takes alignment
constraints into account.
/external/jemalloc/src/jemalloc.c
4bb09830133ffa8b27a95bc3727558007722c152 29-Feb-2012 Jason Evans <je@fb.com> Use glibc allocator hooks.

When jemalloc is used as a libc malloc replacement (i.e. not prefixed),
some particular setups may end up inconsistently calling malloc from
libc and free from jemalloc, or the other way around.

glibc provides hooks to make its functions use alternative
implementations. Use them.

Submitted by Karl Tomlinson and Mike Hommey.
/external/jemalloc/src/jemalloc.c
5965631636c620fba2eb33698accee75fd207aab 29-Feb-2012 Jason Evans <je@fb.com> Do not enforce minimum alignment in memalign().

Do not enforce minimum alignment in memalign(). This is a non-standard
function, and there is disagreement over whether to enforce minimum
alignment. Solaris documentation (whence memalign() originated) says
that minimum alignment is required:

The value of alignment must be a power of two and must be greater than
or equal to the size of a word.

However, Linux's manual page says in its NOTES section:

memalign() may not check that the boundary parameter is correct.

This is descriptive rather than prescriptive, but applications with
bad assumptions about memalign() exist, so be as forgiving as possible.

Reported by Mike Hommey.
/external/jemalloc/src/jemalloc.c
d073a321091800e71ea56f98701253dc0969d879 29-Feb-2012 Jason Evans <je@fb.com> Enable the stats configuration option by default.
/external/jemalloc/src/jemalloc.c
c90ad71237c05473bcb968beddebb0a487c36e75 29-Feb-2012 Jason Evans <je@fb.com> Remove the sysv option.
/external/jemalloc/src/jemalloc.c
f081b88dfbce94c3c7c8faf0b0f91b117fbdfcc6 29-Feb-2012 Jason Evans <je@fb.com> Fix realloc(p, 0) to act like free(p).

Reported by Yoni Londer.
/external/jemalloc/src/jemalloc.c
b172610317babc7f365584ddd7fdaf4eb8d9d04c 29-Feb-2012 Jason Evans <je@fb.com> Simplify small size class infrastructure.

Program-generate small size class tables for all valid combinations of
LG_TINY_MIN, LG_QUANTUM, and PAGE_SHIFT. Use the appropriate table to generate
all relevant data structures, and remove the distinction between
tiny/quantum/cacheline/subpage bins.

Remove --enable-dynamic-page-shift. This option didn't prove useful in
practice, and it prevented optimizations.

Add Tilera architecture support.
/external/jemalloc/src/jemalloc.c
5389146191b279ca3b90028357dd6ad66b283def 14-Feb-2012 Jason Evans <je@fb.com> Remove the opt.lg_prof_bt_max option.

Remove opt.lg_prof_bt_max, and hard code it to 7. The original
intention of this option was to enable faster backtracing by limiting
backtrace depth. However, this makes graphical pprof output very
difficult to interpret. In practice, decreasing sampling frequency is a
better mechanism for limiting profiling overhead.
/external/jemalloc/src/jemalloc.c
0b526ff94da7e59aa947a4d3529b2376794f8b01 14-Feb-2012 Jason Evans <je@fb.com> Remove the opt.lg_prof_tcmax option.

Remove the opt.lg_prof_tcmax option and hard-code a cache size of 1024.
This setting is something that users just shouldn't have to worry about.
If lock contention actually ends up being a problem, the simple solution
available to the user is to reduce sampling frequency.
/external/jemalloc/src/jemalloc.c
6ffbbeb5d60bdf16e15927cb1f173376fe355449 13-Feb-2012 Jason Evans <je@fb.com> Silence compiler warnings.
/external/jemalloc/src/jemalloc.c
4162627757889ea999264c2ddbc3c354768774e2 13-Feb-2012 Jason Evans <je@fb.com> Remove the swap feature.

Remove the swap feature, which enabled per application swap files. In
practice this feature has not proven itself useful to users.
/external/jemalloc/src/jemalloc.c
7372b15a31c63ac5cb9ed8aeabc2a0a3c005e8bf 11-Feb-2012 Jason Evans <je@fb.com> Reduce cpp conditional logic complexity.

Convert configuration-related cpp conditional logic to use static
constant variables, e.g.:

#ifdef JEMALLOC_DEBUG
[...]
#endif

becomes:

if (config_debug) {
[...]
}

The advantage is clearer, more concise code. The main disadvantage is
that data structures no longer have conditionally defined fields, so
they pay the cost of all fields regardless of whether they are used. In
practice, this is only a minor concern; config_stats will go away in an
upcoming change, and config_prof is the only other major feature that
depends on more than a few special-purpose fields.
/external/jemalloc/src/jemalloc.c
30fbef8aeaf65fcd6b265fb9f551e7c2ec8cb22f 06-Nov-2011 Jason Evans <je@fb.com> Fix rallocm() test to support >4KiB pages.
/external/jemalloc/src/jemalloc.c
8e6f8b490dbd4b9ae715267fd401f09a056f92c4 04-Nov-2011 Jason Evans <je@fb.com> Initialize arenas_tsd before setting it.

Reported by: Ethan Burns, Rich Prohaska, Tudor Bosman
/external/jemalloc/src/jemalloc.c
46405e670f9b4831da9c24c15f0f3a537ef2606b 31-Aug-2011 Jason Evans <je@fb.com> Fix a prof-related bug in realloc().

Fix realloc() such that it only records the object passed in as freed if
no OOM error occurs.
/external/jemalloc/src/jemalloc.c
749c2a0ab62089891d8e40840fbf384f12cb8401 13-Aug-2011 Jason Evans <je@fb.com> Add missing prof_malloc() call in allocm().

Add a missing prof_malloc() call in allocm(). Before this fix, negative
object/byte counts could be observed in heap profiles for applications
that use allocm().
/external/jemalloc/src/jemalloc.c
a507004d294ad0c78b4d01559479620ebb272a49 12-Aug-2011 Jason Evans <je@fb.com> Fix off-by-one backtracing issues.

Rewrite prof_alloc_prep() as a cpp macro, PROF_ALLOC_PREP(), in order to
remove any doubt as to whether an additional stack frame is created.
Prior to this change, it was assumed that inlining would reduce the
total number of frames in the backtrace, but in practice behavior wasn't
completely predictable.

Create imemalign() and call it from posix_memalign(), memalign(), and
valloc(), so that all entry points require the same number of stack
frames to be ignored during backtracing.
/external/jemalloc/src/jemalloc.c
b493ce22a4b545c17d5942d0fc65f413dd97743a 12-Aug-2011 Jason Evans <je@fb.com> Conditionalize an isalloc() call in rallocm().

Conditionalize an isalloc() call in rallocm() that be unnecessary.
/external/jemalloc/src/jemalloc.c
183ba50c1940a95080f6cf890ae4ae40200301e7 12-Aug-2011 Jason Evans <je@fb.com> Fix two prof-related bugs in rallocm().

Properly handle boundary conditions for sampled region promotion in
rallocm(). Prior to this fix, some combinations of 'size' and 'extra'
values could cause erroneous behavior. Additionally, size class
recording for promoted regions was incorrect.
/external/jemalloc/src/jemalloc.c
7427525c28d58c423a68930160e3b0fe577fe953 01-Apr-2011 Jason Evans <jasone@canonware.com> Move repo contents in jemalloc/ to top level.
/external/jemalloc/src/jemalloc.c