summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Do not assume dss never decreases.stable-4Uwe L. Korn2017-09-111-36/+35
| | | | | | | | | An sbrk() caller outside jemalloc can decrease the dss, so add a separate atomic boolean to explicitly track whether jemalloc is concurrently calling sbrk(), rather than depending on state outside jemalloc's full control. Fixes #802 for stable-4
* Use openat syscall if availableJim Chen2017-05-123-0/+11
| | | | | | | | | | Some architectures like AArch64 may not have the open syscall because it was superseded by the openat syscall, so check and use SYS_openat if SYS_open is not available. Additionally, Android headers for AArch64 define SYS_open to __NR_open, even though __NR_open is undefined. Undefine SYS_open in that case so SYS_openat is used.
* Fix decommit-related run fragmentation.Jason Evans2017-04-182-39/+71
| | | | | | | | | | | | | | | | When allocating runs with alignment stricter than one page, commit after trimming the head/tail from the initial over-sized allocation, rather than before trimming. This avoids creating clean-but-committed runs; such runs do not get purged (and decommitted as a side effect), so they can cause unnecessary long-term run fragmentation. Do not commit decommitted memory in chunk_recycle() unless asked to by the caller. This allows recycled arena chunks to start in the decommitted state, and therefore increases the likelihood that purging after run deallocation will allow the arena chunk to become a single unused run, thus allowing the chunk as a whole to be discarded. This resolves #766.
* Merge branch 'rc-4.5.0'4.5.0Jason Evans2017-03-0183-515/+2388
|\
| * Update ChangeLog for 4.5.0.Jason Evans2017-03-011-0/+35
| |
| * Add casts to CONF_HANDLE_T_U().Jason Evans2017-03-011-6/+6
| | | | | | | | | | | | | | | | This avoids signed/unsigned comparison warnings when specifying integer constants as inputs. Clean up whitespace and add clarifying parentheses for CONF_HANDLE_SIZE_T(opt_lg_chunk, ...).
| * Alphabetize private symbol names.Jason Evans2017-02-281-1/+1
| |
| * Fix/enhance THP integration.Jason Evans2017-02-2813-21/+177
| | | | | | | | | | | | | | | | | | | | | | | | Detect whether chunks start off as THP-capable by default (according to the state of /sys/kernel/mm/transparent_hugepage/enabled), and use this as the basis for whether to call pages_nohuge() once per chunk during first purge of any of the chunk's page runs. Add the --disable-thp configure option, as well as the the opt.thp mallctl. This resolves #541.
| * restructure *CFLAGS configuration.Jason Evans2017-02-283-111/+141
| | | | | | | | | | | | | | | | | | | | | | | | Convert CFLAGS to be a concatenation: CFLAGS := CONFIGURE_CFLAGS SPECIFIED_CFLAGS EXTRA_CFLAGS This ordering makes it possible to override the flags set by the configure script both during and after configuration, with CFLAGS and EXTRA_CFLAGS, respectively. This resolves #619.
| * Handle race in stats_arena_bins_printQi Wang2017-02-271-3/+13
| | | | | | | | | | | | | | | | | | When multiple threads calling stats_print, race could happen as we read the counters in separate mallctl calls; and the removed assertion could fail when other operations happened in between the mallctl calls. For simplicity, output "race" in the utilization field in this case. This resolves #616.
| * Fix lg_chunk clamping for config_cache_oblivious.Jason Evans2017-02-272-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lg_chunk clamping to take into account cache-oblivious large allocation. This regression only resulted in incorrect behavior if !config_fill (false unless --disable-fill specified) and config_cache_oblivious (true unless --disable-cache-oblivious specified). This regression was introduced by 8a03cf039cd06f9fa6972711195055d865673966 (Implement cache index randomization for large allocations.), which was first released in 4.0.0. This resolves #555.
| * Add some missing explicit casts.Jason Evans2017-02-271-3/+4
| | | | | | | | This resolves #614.
| * Fix huge-aligned allocation.Jason Evans2017-02-276-11/+141
| | | | | | | | | | | | | | | | This regression was caused by b9408d77a63a54fd331f9b81c884f68e6d57f2e5 (Fix/simplify chunk_recycle() allocation size computations.). This resolves #647.
| * Silence harmless warnings discovered via run_tests.sh.Jason Evans2017-02-261-2/+7
| |
| * Test JSON output of malloc_stats_print() and fix bugs.Jason Evans2017-02-263-27/+1035
| | | | | | | | | | | | | | | | Implement and test a JSON validation parser. Use the parser to validate JSON output from malloc_stats_print(), with a significant subset of supported output options. This resolves #583.
| * Fix JSON-mode output for !config_stats and/or !config_prof cases.Jason Evans2017-02-261-9/+10
| | | | | | | | | | | | | | | | These bugs were introduced by b599b32280e1142856b0b96293a71e1684b1ccfb (Add "J" (JSON) support to malloc_stats_print().), which was first released in 4.3.0. This resolves #615.
| * Fix chunk_alloc_dss() regression.Jason Evans2017-02-261-18/+27
| | | | | | | | | | | | | | Fix chunk_alloc_dss() to account for bytes that are not a multiple of the chunk size. This regression was introduced by e2bcf037d445a84a71c7997670819ebd0a893b4a (Make dss operations lockless.), which was first released in 4.3.0.
| * Relax witness assertions related to prof_gdump().Jason Evans2017-02-233-6/+19
| | | | | | | | | | | | | | | | | | | | In some cases the prof machinery allocates (in order to modify the bt2gctx hash table), and such operations are synchronized via bt2gctx_mtx. Rather than asserting that no locks are held on entry into functions that may call prof_gdump(), make the weaker assertion that no "core" locks are held. The prof machinery enqueues dumps triggered by prof_gdump() calls when bt2gctx_mtx is held, so this weakened assertion avoids false failures in such cases.
| * Add witness_assert_depth[_to_rank]().Jason Evans2017-02-237-107/+141
| | | | | | | | | | This makes it possible to make lock state assertions about precisely which locks are held.
| * Enable mutex witnesses even when !isthreaded.Jason Evans2017-02-231-7/+5
| | | | | | | | | | | | This fixes interactions with witness_assert_depth[_to_rank](), which was added in dad74bd3c811ca2b1af1fd57b28f2456da5ba08b (Convert witness_assert_lockless() to witness_assert_lock_depth().).
| * CI: Run --enable-debug builds on windowsDavid Goldblatt2017-02-231-1/+15
| | | | | | | | This will hopefully catch some windows-specific bugs.
| * Use MALLOC_CONF rather than malloc_conf for tests.Jason Evans2017-02-2338-87/+129
| | | | | | | | | | | | | | | | | | malloc_conf does not reliably work with MSVC, which complains of "inconsistent dll linkage", i.e. its inability to support the application overriding malloc_conf when dynamically linking/loading. Work around this limitation by adding test harness support for per test shell script sourcing, and converting all tests to use MALLOC_CONF instead of malloc_conf.
| * Fix/refactor tcaches synchronization.Jason Evans2017-02-236-38/+110
| | | | | | | | | | | | | | Synchronize tcaches with tcaches_mtx rather than ctl_mtx. Add missing synchronization for tcache flushing. This bug was introduced by 1cb181ed632e7573fb4eab194e4d216867222d27 (Implement explicit tcache support.), which was first released in 4.0.0.
| * Repair file permissions.Jason Evans2017-02-2223-0/+0
| | | | | | | | | | | | | | This regression was caused by 8f61fdedb908c29905103b22dda32ceb29cd8ede (Uniformly cast mallctl[bymib]() oldp/newp arguments to (void *).). This resolves #538.
| * Beef up travis CI integration testingDavid Goldblatt2017-02-212-11/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduces gen_travis.py, which generates .travis.yml, and updates .travis.yml to be the generated version. The travis build matrix approach doesn't play well with mixing and matching various different environment settings, so we generate every build explicitly, rather than letting them do it for us. To avoid abusing travis resources (and save us time waiting for CI results), we don't test every possible combination of options; we only check up to 2 unusual settings at a time.
| * Avoid redeclaring glibc's secure_getenvTamir Duberstein2017-01-251-5/+6
| | | | | | | | | | | | Avoid the name secure_getenv to avoid redeclaring secure_getenv when secure_getenv is present but its use is manually disabled via ac_cv_func_secure_getenv=no.
| * Fix lock order reversal during gdump.Jason Evans2017-01-244-30/+61
| |
| * Convert witness_assert_lockless() to witness_assert_lock_depth().Jason Evans2017-01-245-81/+102
| | | | | | | | | | This makes it possible to make lock state assertions about precisely which locks are held.
| * Add dummy implementations for most remaining OSX zone allocator functionsMike Hommey2017-01-181-10/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some system libraries are using malloc_default_zone() and then using some of the malloc_zone_* API. Under normal conditions, those functions check the malloc_zone_t/malloc_introspection_t struct for the values that are allowed to be NULL, so that a NULL deref doesn't happen. As of OSX 10.12, malloc_default_zone() doesn't return the actual default zone anymore, but returns a fake, wrapper zone. The wrapper zone defines all the possible functions in the malloc_zone_t/malloc_introspection_t struct (almost), and calls the function from the registered default zone (jemalloc in our case) on its own. Without checking whether the pointers are NULL. This means that a system library that calls e.g. malloc_zone_batch_malloc(malloc_default_zone(), ...) ends up trying to call jemalloc_zone.batch_malloc, which is NULL, and crash follows. So as of OSX 10.12, the default zone is required to have all the functions available (really, the same as the wrapper zone), even if they do nothing. This is arguably a bug in libsystem_malloc in OSX 10.12, but jemalloc still needs to work in that case.
| * Don't rely on OSX SDK malloc/malloc.h for malloc_zone struct definitionsMike Hommey2017-01-184-69/+86
| | | | | | | | | | | | | | | | | | | | The SDK jemalloc is built against might be not be the latest for various reasons, but the resulting binary ought to work on newer versions of OSX. In order to ensure this, we need the fullest definitions possible, so copy what we need from the latest version of malloc/malloc.h available on opensource.apple.com.
| * Use better pre-processor defines for sparc64John Paul Adrian Glaubitz2017-01-131-1/+1
|/ | | | | | | | Currently, jemalloc detects sparc64 targets by checking whether __sparc64__ is defined. However, this definition is used on BSD targets only. Linux targets define both __sparc__ and __arch64__ for sparc64. Since this also works on BSD, rather use __sparc__ and __arch64__ instead of __sparc64__ to detect sparc64 targets.
* Merge branch 'rc-4.4.0'4.4.0Jason Evans2016-12-0455-705/+1396
|\
| * Update ChangeLog for 4.4.0.Jason Evans2016-12-041-0/+27
| |
| * Add --disable-syscall.Jason Evans2016-12-045-15/+33
| | | | | | | | This resolves #517.
| * Update configure cache file example.Jason Evans2016-12-041-12/+6
| |
| * Fix pages_purge() when using MADV_DONTNEED.Jason Evans2016-12-041-1/+1
| | | | | | | | | | | | This fixes a regression caused by e98a620c59ac20b13e2de796164cc67f050ed2bf (Mark partially purged arena chunks as non-hugepage.).
| * Implement a more reliable detection scheme for os_unfair_lock.John Szakmeister2016-11-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The core issue here is the weak linking of the symbol, and in certain environments--for instance, using the latest Xcode (8.1) with the latest SDK (10.12)--os_unfair_lock may resolve even though you're compiling on a host that doesn't support it (10.11). We can use the availability macros to circumvent this problem, and detect that we're not compiling for a target that is going to support them and error out at compile time. The other alternative is to do a runtime check, but that presents issues for cross-compiling.
| * Mark partially purged arena chunks as non-hugepage.Jason Evans2016-11-249-5/+110
| | | | | | | | | | | | | | | | | | | | | | | | Add the pages_[no]huge() functions, which toggle huge page state via madvise(..., MADV_[NO]HUGEPAGE) calls. The first time a page run is purged from within an arena chunk, call pages_nohuge() to tell the kernel to make no further attempts to back the chunk with huge pages. Upon arena chunk deletion, restore the associated virtual memory to its original state via pages_huge(). This resolves #243.
| * Enable overriding JEMALLOC_{ALLOC,FREE}_JUNK.Jason Evans2016-11-221-2/+6
| | | | | | | | This resolves #509.
| * Add pthread_atfork(3) feature test.Jason Evans2016-11-173-2/+14
| | | | | | | | | | | | Some versions of Android provide a pthreads library without providing pthread_atfork(), so in practice a separate feature test is necessary for the latter.
| * Refactor madvise(2) configuration.Jason Evans2016-11-173-30/+39
| | | | | | | | | | | | | | | | | | Add feature tests for the MADV_FREE and MADV_DONTNEED flags to madvise(2), so that MADV_FREE is detected and used for Linux kernel versions 4.5 and newer. Refactor pages_purge() so that on systems which support both flags, MADV_FREE is preferred over MADV_DONTNEED. This resolves #387.
| * Remove a residual comment.Jason Evans2016-11-171-1/+0
| |
| * Avoid gcc tautological-compare warnings.Jason Evans2016-11-172-12/+26
| |
| * Avoid gcc type-limits warnings.Jason Evans2016-11-171-14/+32
| |
| * Document how to use --cache configure option.Jason Evans2016-11-161-0/+15
| | | | | | | | This resolves #494.
| * Revert "Add JE_RUNNABLE() and use it for os_unfair_lock_*() test."Jason Evans2016-11-161-16/+1
| | | | | | | | | | | | This reverts commit 45f83a2ac6a9cd3b21675766127ee85910e54156. JE_RUNNABLE() causes general cross-compilation issues.
| * Fix an MSVC compiler warning.Jason Evans2016-11-161-1/+1
| |
| * Uniformly cast mallctl[bymib]() oldp/newp arguments to (void *).Jason Evans2016-11-1527-362/+397
| | | | | | | | | | This avoids warnings in some cases, and is otherwise generally good hygiene.
| * Explicitly cast negative constants meant for use as unsigned.Jason Evans2016-11-151-3/+5
| |
| * Add cast to silence (harmless) conversion warning.Jason Evans2016-11-151-1/+1
| |