summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Tweak code to allow compilation of concatenated src/*.c sources.Jason Evans2015-11-122-43/+46
| | | | This resolves #294.
* Fix a comment.Jason Evans2015-11-121-1/+1
|
* Fast-path improvement: reduce # of branches and unnecessary operations.Qi Wang2015-11-104-97/+150
| | | | | | - Combine multiple runtime branches into a single malloc_slow check. - Avoid calling arena_choose / size2index / index2size on fast path. - A few micro optimizations.
* Add function to destroy treeJoshua Kahn2015-11-091-1/+40
| | | | | | | ex_destroy iterates over the tree using post-order traversal so nodes can be removed and processed by the callback function without paying the cost to rebalance the tree. The destruction process cannot be stopped once started.
* Allow const keys for lookupJoshua Kahn2015-11-092-11/+11
| | | | | | Signed-off-by: Steve Dougherty <sdougherty@barracuda.com> This resolves #281.
* Assert compact color bit is unusedSteve Dougherty2015-11-091-1/+10
| | | | | | Signed-off-by: Joshua Kahn <jkahn@barracuda.com> This resolves #280.
* use correct macro definitions for clang-clNathan Froyd2015-11-091-26/+26
| | | | | | | | | | clang-cl, an MSVC-compatible frontend built on top of clang, defined _MSC_VER *and* supports __attribute__ syntax. The ordering of the checks in jemalloc_macros.h.in, however, do the wrong thing for clang-cl, as we want the Windows-specific macro definitions for clang-cl. To support this use case, we reorder the checks so that _MSC_VER is checked first (which includes clang-cl), and then JEMALLOC_HAVE_ATTR) is checked. No functionality change intended.
* Fix a xallocx(..., MALLOCX_ZERO) bug.Jason Evans2015-09-251-0/+4
| | | | | | | | Fix xallocx(..., MALLOCX_ZERO to zero the last full trailing page of large allocations that have been randomly assigned an offset of 0 when --enable-cache-oblivious configure option is enabled. This addresses a special case missed in d260f442ce693de4351229027b37b3293fcbfd7d (Fix xallocx(..., MALLOCX_ZERO) bugs.).
* Fix tsd_boot1() to use explicit 'void' parameter list.Craig Rodrigues2015-09-211-4/+4
|
* Address portability issues on Solaris.Jason Evans2015-09-151-1/+1
| | | | | | | | Don't assume Bourne shell is in /bin/sh when running size_classes.sh . Consider __sparcv9 a synonym for __sparc64__ when defining LG_QUANTUM. This resolves #275.
* Resolve an unsupported special case in arena_prof_tctx_set().Jason Evans2015-09-154-3/+52
| | | | | | | | | | | 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().)
* Fix prof_{malloc,free}_sample_object() call order in prof_realloc().Jason Evans2015-09-151-3/+8
| | | | | | Fix prof_realloc() to call prof_free_sampled_object() after calling prof_malloc_sample_object(). Prior to this fix, if tctx and old_tctx were the same, the tctx could have been prematurely destroyed.
* Make one call to prof_active_get_unlocked() per allocation event.Jason Evans2015-09-151-8/+10
| | | | | | | 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.
* Rename arena_maxclass to large_maxclass.Jason Evans2015-09-123-4/+4
| | | | | arena_maxclass is no longer an appropriate name, because arenas also manage huge allocations.
* Fix xallocx() bugs.Jason Evans2015-09-124-6/+10
| | | | | Fix xallocx() bugs related to the 'extra' parameter when specified as non-zero.
* Fix "prof.reset" mallctl-related corruption.Jason Evans2015-09-101-2/+3
| | | | | | | Fix heap profiling to distinguish among otherwise identical sample sites with interposed resets (triggered via the "prof.reset" mallctl). This bug could cause data structure corruption that would most likely result in a segfault.
* Fix pointer comparision with undefined behavior.Jason Evans2015-09-041-2/+2
| | | | | | | This didn't cause bad code generation in the one case spot-checked (gcc 4.8.1), but had the potential to to so. This bug was introduced by 594c759f37c301d0245dc2accf4d4aaf9d202819 (Optimize arena_prof_tctx_set().).
* Optimize arena_prof_tctx_set().Jason Evans2015-09-022-10/+23
| | | | | Optimize arena_prof_tctx_set() to avoid reading run metadata when deciding whether it's actually necessary to write.
* Add JEMALLOC_CXX_THROW to the memalign() function prototype.Jason Evans2015-08-261-1/+1
| | | | | | | | | | Add JEMALLOC_CXX_THROW to the memalign() function prototype, in order to match glibc and avoid compilation errors when including both jemalloc/jemalloc.h and malloc.h in C++ code. This change was unintentionally omitted from ae93d6bf364e9db9f9ee69c3e5f9df110d8685a4 (Avoid function prototype incompatibilities.).
* Silence compiler warnings for unreachable code.Jason Evans2015-08-201-12/+14
| | | | Reported by Ingvar Hagelund.
* Rename index_t to szind_t to avoid an existing type on Solaris.Jason Evans2015-08-193-42/+42
| | | | This resolves #256.
* Don't bitshift by negative amounts.Jason Evans2015-08-192-9/+41
| | | | | | | | Don't bitshift by negative amounts when encoding/decoding run sizes in chunk header maps. This affected systems with page sizes greater than 8 KiB. Reported by Ingvar Hagelund <ingvar@redpill-linpro.com>.
* Fix a comment.Jason Evans2015-08-131-1/+1
|
* Fix gcc build failure (define __has_builtin).Jason Evans2015-08-121-0/+3
|
* Check whether gcc version supports __builtin_unreachable().Jason Evans2015-08-121-0/+11
|
* Update list of private symbols.Jason Evans2015-08-121-25/+14
|
* Refactor arena_mapbits_{small,large}_set() to not preserve unzeroed.Jason Evans2015-08-111-11/+6
| | | | | Fix arena_run_split_large_helper() to treat newly committed memory as zeroed.
* Fix build failure.Jason Evans2015-08-111-1/+1
| | | | | | | | This regression was introduced by de249c8679a188065949f2560b1f0015ea6534b4 (Arena chunk decommit cleanups and fixes.). This resolves #254.
* Refactor arena_mapbits unzeroed flag management.Jason Evans2015-08-112-15/+12
| | | | | | Only set the unzeroed flag when initializing the entire mapbits entry, rather than mutating just the unzeroed bit. This simplifies the possible mapbits state transitions.
* Arena chunk decommit cleanups and fixes.Jason Evans2015-08-113-2/+4
| | | | | Decommit arena chunk header during chunk deallocation if the rest of the chunk is decommitted.
* Implement chunk hook support for page run commit/decommit.Jason Evans2015-08-077-74/+110
| | | | | | | | | Cascade from decommit to purge when purging unused dirty pages, so that it is possible to decommit cleaned memory rather than just purging. For non-Windows debug builds, decommit runs rather than purging them, since this causes access of deallocated runs to segfault. This resolves #251.
* work around _FORTIFY_SOURCE false positiveDaniel Micay2015-08-041-0/+3
| | | | | | | | | | | In builds with profiling disabled (default), the opt_prof_prefix array has a one byte length as a micro-optimization. This will cause the usage of write in the unused profiling code to be statically detected as a buffer overflow by Bionic's _FORTIFY_SOURCE implementation as it tries to detect read overflows in addition to write overflows. This works around the problem by informing the compiler that not_reached() means code in unreachable in release builds.
* MSVC compatibility changesMatthijs2015-08-043-8/+29
| | | | | | - 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
* Generalize chunk management hooks.Jason Evans2015-08-048-38/+151
| | | | | | | | | | | | | | | | | | | | Add the "arena.<i>.chunk_hooks" mallctl, which replaces and expands on the "arena.<i>.chunk.{alloc,dalloc,purge}" mallctls. The chunk hooks allow control over chunk allocation/deallocation, decommit/commit, purging, and splitting/merging, such that the application can rely on jemalloc's internal chunk caching and retaining functionality, yet implement a variety of chunk management mechanisms and policies. Merge the chunks_[sz]ad_{mmap,dss} red-black trees into chunks_[sz]ad_retained. This slightly reduces how hard jemalloc tries to honor the dss precedence setting; prior to this change the precedence setting was also consulted when recycling chunks. Fix chunk purging. Don't purge chunks in arena_purge_stashed(); instead deallocate them in arena_unstash_purged(), so that the dirty memory linkage remains valid until after the last time it is used. This resolves #176 and #201.
* Implement support for non-coalescing maps on MinGW.Jason Evans2015-07-252-0/+16
| | | | | | | | - Do not reallocate huge objects in place if the number of backing chunks would change. - Do not cache multi-chunk mappings. This resolves #213.
* Fix huge_palloc() to handle size rather than usize input.Jason Evans2015-07-241-1/+1
| | | | | | | | | | huge_ralloc() passes a size that may not be precisely a size class, so make huge_palloc() handle the more general case of a size input rather than usize. This regression appears to have been introduced by the addition of in-place huge reallocation; as such it was never incorporated into a release.
* Fix sa2u() regression.Jason Evans2015-07-241-1/+1
| | | | | | | | | Take large_pad into account when determining whether an aligned allocation can be satisfied by a large size class. This regression was introduced by 8a03cf039cd06f9fa6972711195055d865673966 (Implement cache index randomization for large allocations.).
* Leave PRI* macros defined after using them to define FMT*.Jason Evans2015-07-231-11/+0
| | | | | Macro expansion happens too late for the #undef directives to work as a mechanism for preventing accidental direct use of the PRI* macros.
* Fix MinGW-related portability issues.Jason Evans2015-07-235-346/+77
| | | | | | | | | | | | | Create and use FMT* macros that are equivalent to the PRI* macros that inttypes.h defines. This allows uniform use of the Unix-specific format specifiers, e.g. "%zu", as well as avoiding Windows-specific definitions of e.g. PRIu64. Add ffs()/ffsl() support for compiling with gcc. Extract compatibility definitions of ENOENT, EINVAL, EAGAIN, EPERM, ENOMEM, and ENORANGE into include/msvc_compat/windows_extra.h and use the file for tests as well as for core jemalloc code.
* Add JEMALLOC_FORMAT_PRINTF().Jason Evans2015-07-223-11/+25
| | | | | | Replace JEMALLOC_ATTR(format(printf, ...). with JEMALLOC_FORMAT_PRINTF(), so that configuration feature tests can omit the attribute if it would cause extraneous compilation warnings.
* Move JEMALLOC_NOTHROW just after return type.Jason Evans2015-07-212-38/+42
| | | | | | Only use __declspec(nothrow) in C++ mode. This resolves #244.
* Remove JEMALLOC_ALLOC_SIZE annotations on functions not returning pointersMike Hommey2015-07-211-2/+2
| | | | | | | | 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.
* Remove extraneous ';' on closing 'extern "C"'Dave Rigby2015-07-161-1/+1
| | | | | | | | Fixes warning with newer GCCs: include/jemalloc/jemalloc.h:229:2: warning: extra ';' [-Wpedantic] }; ^
* Change default chunk size from 256 KiB to 2 MiB.Jason Evans2015-07-161-1/+1
| | | | | | This change improves interaction with transparent huge pages, e.g. reduced page faults (at least in the absence of unused dirty page purging).
* Revert to first-best-fit run/chunk allocation.Jason Evans2015-07-161-1/+1
| | | | | | | | | This effectively reverts 97c04a93838c4001688fe31bf018972b4696efe2 (Use first-fit rather than first-best-fit run/chunk allocation.). In some pathological cases, first-fit search dominates allocation time, and it also tends not to converge as readily on a steady state of memory layout, since precise allocation order has a bigger effect than for first-best-fit.
* Add configure test for alloc_size attribute.Jason Evans2015-07-102-2/+10
|
* Avoid function prototype incompatibilities.Jason Evans2015-07-103-24/+54
| | | | | | | | | 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.
* Fix an integer overflow bug in {size2index,s2u}_compute().Jason Evans2015-07-101-2/+6
| | | | | | | This {bug,regression} was introduced by 155bfa7da18cab0d21d87aa2dce4554166836f5d (Normalize size classes.). This resolves #241.
* Fix MinGW build warnings.Jason Evans2015-07-081-8/+30
| | | | | | | | | | Conditionally define ENOENT, EINVAL, etc. (was unconditional). Add/use PRIzu, PRIzd, and PRIzx for use in malloc_printf() calls. gcc issued (harmless) warnings since e.g. "%zu" should be "%Iu" on Windows, and the alternative to this workaround would have been to disable the function attributes which cause gcc to look for type mismatches in formatted printing function calls.
* Optimizations for WindowsMatthijs2015-06-251-0/+12
| | | | | | | - 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