summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
Commit message (Collapse)AuthorAgeFilesLines
* Fix large calloc() zeroing bugs.Jason Evans2012-05-111-5/+10
| | | | | | | | | Refactor code such that arena_mapbits_{large,small}_set() always preserves the unzeroed flag, and manually manipulate the unzeroed flag in the one case where it actually gets reset (in arena_chunk_purge()). This fixes unzeroed preservation bugs in arena_run_split() and arena_ralloc_large_grow(). These bugs caused large calloc() to return non-zeroed memory under some circumstances.
* Update a comment.Jason Evans2012-05-101-9/+9
|
* Export je_memalign and je_vallocMike Hommey2012-05-091-0/+9
| | | | | | da99e31 removed attributes on je_memalign and je_valloc, while they didn't have a definition in the jemalloc.h header, thus making them non-exported. Export them again, by defining them in the jemalloc.h header.
* Add the --enable-mremap option.Jason Evans2012-05-092-6/+16
| | | | | | Add the --enable-mremap option, and disable the use of mremap(2) by default, for the same reason that freeing chunks via munmap(2) is disabled by default on Linux: semi-permanent VM map fragmentation.
* Further optimize and harden arena_salloc().Jason Evans2012-05-022-34/+69
| | | | | | | | | Further optimize arena_salloc() to only look at the binind chunk map bits in the common case. Add more sanity checks to arena_salloc() that detect chunk map inconsistencies for large allocations (whether due to allocator bugs or application bugs).
* Fix partial rename of s/EXPORT/JEMALLOC_EXPORT/g.Jason Evans2012-05-021-5/+5
|
* Update private namespace mangling.Jason Evans2012-05-021-12/+11
|
* Make malloc_write() non-inline.Jason Evans2012-05-021-11/+1
| | | | | Make malloc_write() non-inline, in order to resolve its dependency on je_malloc_write().
* Make CACHELINE a raw constant.Jason Evans2012-05-021-1/+4
| | | | | | | Make CACHELINE a raw constant in order to work around a __declspec(align()) limitation. Submitted by Mike Hommey.
* Optimize malloc() and free() fast paths.Jason Evans2012-05-024-134/+320
| | | | | | | | | | Embed the bin index for small page runs into the chunk page map, in order to omit [...] in the following dependent load sequence: ptr-->mapelm-->[run-->bin-->]bin_info Move various non-critcal code out of the inlined function chain into helper functions (tcache_event_hard(), arena_dalloc_small(), and locking).
* Add support for MSVCMike Hommey2012-05-013-4/+55
| | | | Tested with MSVC 8 32 and 64 bits.
* Replace JEMALLOC_ATTR with various different macros when it makes senseMike Hommey2012-05-013-28/+37
| | | | | | 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).
* Few configure.ac adjustmentsMike Hommey2012-05-011-2/+2
| | | | | | - Use the extensions autoconf finds for object and executable files. - Remove the sorev variable, and replace SOREV definition with sorev's. - Default to je_ prefix on win32.
* Use Get/SetLastError on Win32Mike Hommey2012-04-302-3/+37
| | | | | | | | | 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.
* Avoid variable length arrays and remove declarations within codeMike Hommey2012-04-292-1/+16
| | | | | | | | | | | | MSVC doesn't support C99, and building as C++ to be able to use them is dangerous, as C++ and C99 are incompatible. Introduce a VARIABLE_ARRAY macro that either uses VLA when supported, or alloca() otherwise. Note that using alloca() inside loops doesn't quite work like VLAs, thus the use of VARIABLE_ARRAY there is discouraged. It might be worth investigating ways to check whether VARIABLE_ARRAY is used in such context at runtime in debug builds and bail out if that happens.
* Fix more prof_tdata resurrection corner cases.Jason Evans2012-04-291-5/+7
|
* Handle prof_tdata resurrection.Jason Evans2012-04-291-3/+15
| | | | | Handle prof_tdata resurrection during thread shutdown, similarly to how tcache and quarantine handle resurrection.
* Fix a PROF_ALLOC_PREP() error path.Jason Evans2012-04-251-1/+3
| | | | | Fix a PROF_ALLOC_PREP() error path to initialize the return value to NULL.
* Fix ctl regression.Jason Evans2012-04-241-6/+6
| | | | | Fix ctl to correctly compute the number of children at each level of the ctl tree.
* Avoid using a union for ctl_node_sMike Hommey2012-04-231-12/+15
| | | | | | | MSVC doesn't support C99, and as such doesn't support designated initialization of structs and unions. As there is never a mix of indexed and named nodes, it is pretty straightforward to use a different type for each.
* Fix heap profiling bugs.Jason Evans2012-04-222-9/+35
| | | | | | | | | | | Fix a potential deadlock that could occur during interval- and growth-triggered heap profile dumps. Fix an off-by-one heap profile statistics bug that could be observed in interval- and growth-triggered heap profiles. Fix heap profile dump filename sequence numbers (regression during conversion to malloc_snprintf()).
* Remove unused #includesMike Hommey2012-04-221-2/+0
|
* Add support for MingwMike Hommey2012-04-223-13/+125
|
* Remove mmap_unaligned.Jason Evans2012-04-223-11/+2
| | | | | | | | | | | | | 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.
* Fix chunk allocation/deallocation bugs.Jason Evans2012-04-211-1/+1
| | | | | | | | | | | | Fix chunk_alloc_dss() to zero memory when requested. Fix chunk_dealloc() to avoid chunk_dealloc_mmap() for dss-allocated memory. Fix huge_palloc() to always junk fill when requested. Improve chunk_recycle() to report that memory is zeroed as a side effect of pages_purge().
* Fix a memory corruption bug in chunk_alloc_dss().Jason Evans2012-04-211-1/+1
| | | | | | | | | Fix a memory corruption bug in chunk_alloc_dss() that was due to claiming newly allocated memory is zeroed. Reverse order of preference between mmap() and sbrk() to prefer mmap(). Clean up management of 'zero' parameter in chunk_alloc*().
* Fix isthreaded-related build breakage.Jason Evans2012-04-201-0/+1
|
* Add missing private namespace mangling.Jason Evans2012-04-201-0/+46
|
* Don't mangle pthread_create().Jason Evans2012-04-201-1/+0
| | | | Don't mangle pthread_create(); it's an exported symbol when defined.
* Make arena_salloc() an inline function.Jason Evans2012-04-203-10/+50
|
* Remove extra argument for malloc_tsd_cleanup_registerMike Hommey2012-04-191-10/+5
| | | | | Bookkeeping an extra argument that actually only stores a function pointer for a function we already have is not very useful.
* Remove initialization of the non-TLS tsd wrapper from static memoryMike Hommey2012-04-191-12/+3
| | | | | | Using static memory when malloc_tsd_malloc fails means all threads share the same wrapper and thus the same wrapped value. This defeats the purpose of TSD.
* Initialize all members of non-TLS tsd wrapper when creating itMike Hommey2012-04-191-0/+1
| | | | | | Not setting the initialized member leads to randomly calling the cleanup function in cases it shouldn't be called (and isn't called in other implementations).
* Make special FreeBSD function overrides visible.Jason Evans2012-04-191-0/+3
| | | | | | Make special FreeBSD libc/libthr function overrides for _malloc_prefork(), _malloc_postfork(), and _malloc_thread_cleanup() visible.
* Add a pages_purge function to wrap madvise(JEMALLOC_MADV_PURGE) callsMike Hommey2012-04-193-7/+3
| | | | | This will be used to implement the feature on mingw, which doesn't have madvise.
* Update prof defaults to match common usage.Jason Evans2012-04-171-1/+2
| | | | | | | | | 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.
* Add atomic(9) implementations of atomic operations.Jason Evans2012-04-173-5/+48
| | | | | Add atomic(9) implementations of atomic operations. These are used on FreeBSD for non-x86 architectures.
* Replace fprintf with malloc_printf in tests.Mike Hommey2012-04-171-0/+3
|
* Use echo instead of cat in loops in size_classes.shMike Hommey2012-04-171-21/+11
| | | | | This avoids fork/exec()ing in loops, as echo is a builtin, and makes size_classes.sh much faster (from > 10s to < 0.2s on mingw on my machine).
* Add/remove missing/cruft entries to/from private_namespace.h.Jason Evans2012-04-141-13/+52
|
* Disable munmap() if it causes VM map holes.Jason Evans2012-04-135-3/+23
| | | | | | | | | | | 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.
* Use a stub replacement and disable dss when sbrk is not supportedMike Hommey2012-04-121-0/+3
|
* Normalize aligned allocation algorithms.Jason Evans2012-04-123-41/+28
| | | | | | | | | | | | | | | 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()).
* Implement Valgrind support, redzones, and quarantine.Jason Evans2012-04-118-44/+263
| | | | | | | | | | | | | 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.
* Add alignment support to chunk_alloc().Mike Hommey2012-04-103-3/+3
|
* Remove MAP_NORESERVE supportMike Hommey2012-04-101-1/+0
| | | | It was only used by the swap feature, and that is gone.
* Remove arena_malloc_prechosen().Jason Evans2012-04-061-14/+0
| | | | | Remove arena_malloc_prechosen(), now that arena_malloc() can be invoked in a way that is semantically equivalent.
* Add utrace(2)-based tracing (--enable-utrace).Jason Evans2012-04-053-0/+16
|
* Revert "Use ffsl() in ALLOCM_ALIGN()."Jason Evans2012-04-041-1/+6
| | | | | | | | This reverts commit 722b370399fd6734de6781285ce9a0cffd547bdd. Unfortunately, glibc requires _GNU_SOURCE to be defined before including string.h, but there is no reliable way to get the prototype within jemalloc.h unless _GNU_SOURCE was already defined.
* Add tls_model configuration.Jason Evans2012-04-042-3/+6
| | | | | The tls_model attribute isn't supporte by clang (yet?), so add a configure test that defines JEMALLOC_TLS_MODEL appropriately.