summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Avoid crashes when system libraries use the purgeable zone allocatorMike Hommey2012-03-302-6/+27
|
* Move zone registration to zone.cMike Hommey2012-03-304-28/+23
|
* Change AC_COMPILE_IFELSE into AC_LINK_IFELSE for the __sync_{add, ↵Mike Hommey2012-03-301-14/+14
| | | | | | | sub}_and_fetch() test With the Android NDK, __sync_{add,sub}_and_fetch() compile fine for uint64_t, but the corresponding libgcc function aren't there.
* Add a SYS_write definition on systems where it is not defined in headersMike Hommey2012-03-302-0/+13
| | | | | Namely, in the Android NDK headers, SYS_write is not defined; but __NR_write is.
* Don't use pthread_atfork to register prefork/postfork handlers on OSXMike Hommey2012-03-281-1/+1
| | | | OSX libc calls zone allocators' force_lock/force_unlock already.
* Add the "thread.tcache.enabled" mallctl.Jason Evans2012-03-277-36/+271
|
* Force the lazy-lock feature on FreeBSD.Jason Evans2012-03-241-0/+5
| | | | | | Force the lazy-lock feature on FreeBSD in order to avoid pthread_self(), because it causes allocation. (This change was mistakenly omitted from 41b6afb834b1f5250223678c52bd4f013d4234f6.)
* Check for NULL ptr in malloc_usable_size().Jason Evans2012-03-261-4/+2
| | | | | | 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).
* Make zone_{free, realloc, free_definite_size} fallback to the system ↵Mike Hommey2012-03-261-4/+17
| | | | | | | | | | | | allocator if they are called with a pointer that jemalloc didn't allocate It turns out some OSX system libraries (like CoreGraphics on 10.6) like to call malloc_zone_* functions, but giving them pointers that weren't allocated with the zone they are using. Possibly, they do malloc_zone_malloc(malloc_default_zone()) before we register the jemalloc zone, and malloc_zone_realloc(malloc_default_zone()) after. malloc_default_zone() returning a different value in both cases.
* Fix glibc hooks when using both --with-jemalloc-prefix and --with-manglingMike Hommey2012-03-261-1/+9
|
* Use __sync_add_and_fetch and __sync_sub_and_fetch when they are availableMike Hommey2012-03-263-3/+65
| | | | | | | These functions may be available as inlines or as libgcc functions. In the former case, a __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macro is defined. But we still want to use these functions in the latter case, when we don't have our own implementation.
* Remove malloc_mutex_trylock().Jason Evans2012-03-251-15/+0
| | | | Remove malloc_mutex_trylock(); it has not been used for quite some time.
* Port to FreeBSD.Jason Evans2012-02-0313-47/+237
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove ephemeral mutexes.Jason Evans2012-03-246-41/+87
| | | | | | | | | | | 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().
* Forcibly disable TLS on OS X.Jason Evans2012-03-231-1/+5
| | | | | | | Forcibly disable TLS on OS X. gcc and llvm-gcc on OS X do not support TLS, but clang does. Unfortunately, the implementation calls malloc() internally during TLS initialization, which causes an unresolvable bootstrapping issue.
* Remove -no-cpp-precomp compiler flag for OS X.Jason Evans2012-03-231-1/+1
| | | | | Remove the -no-cpp-precomp compiler flag when compiling on OS X. clang does not support the flag, and gcc works fine without it.
* Restructure atomic_*_z().Jason Evans2012-03-231-16/+29
| | | | | Restructure atomic_*_z() so that no casting within macros is necessary. This avoids warnings when compiling with clang.
* Add JEMALLOC_CC_SILENCE_INIT().Jason Evans2012-03-234-44/+23
| | | | | Add JEMALLOC_CC_SILENCE_INIT(), which provides succinct syntax for initializing a variable to avoid a spurious compiler warning.
* Implement tsd.Jason Evans2012-03-2319-362/+704
| | | | | | | | | | | | | 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.
* Improve zone support for OSXMike Hommey2012-03-203-207/+63
| | | | | | | 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.
* Unbreak mac after commit 4e2e3ddMike Hommey2012-03-201-1/+1
|
* Generalize dlsym() configuration.Jason Evans2012-03-191-2/+4
| | | | | Generalize dlsym() configuration to succeed if dlsym() is in libc rather than libdl.
* Invert NO_TLS to JEMALLOC_TLS.Jason Evans2012-03-199-28/+28
|
* Use AC_LINK_IFELSE() rather than AC_RUN_IFELSE() in JE_COMPILABLE().Jason Evans2012-03-191-5/+5
| | | | Reported by Mike Hommey.
* Fix various documentation formatting regressions.Jason Evans2012-03-192-22/+33
|
* Rename the "tcache.flush" mallctl to "thread.tcache.flush".Jason Evans2012-03-172-24/+24
|
* Look for pthreads functionality in libc.Jason Evans2012-03-161-1/+4
| | | | | | | | If there is no libpthread, look for pthreads functionality in libc before failing to configure pthreads. This is necessary on at least the Android platform. Reported by Mike Hommey.
* Remove #include <sys/sysctl.h>.Jason Evans2012-03-161-1/+0
| | | | | Remove #include <sys/sysctl.h>, which is no longer needed (now using sysconf(3) to get number of CPUs).
* Fix fork-related bugs.Jason Evans2012-03-1313-36/+192
| | | | | | | | | 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.
* Modify malloc_vsnprintf() validation code.Jason Evans2012-03-132-4/+9
| | | | | | Modify malloc_vsnprintf() validation code to verify that output is identical to vsnprintf() output, even if both outputs are truncated due to buffer exhaustion.
* Implement aligned_alloc().Jason Evans2012-03-138-14/+218
| | | | | | | | 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.
* Fix a regression in JE_COMPILABLE().Jason Evans2012-03-133-24/+18
| | | | | | | 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.
* Fix malloc_stats_print() option support.Jason Evans2012-03-131-6/+8
| | | | Fix malloc_stats_print() to honor 'b' and 'l' in the opts parameter.
* Update config.guess and config.sub.Jason Evans2012-03-122-576/+874
|
* Fix --with-mangling/--with-jemalloc-prefix interaction.Jason Evans2012-03-121-1/+4
| | | | | | Fix --with-mangling to remove mangled symbols from the set of functions to apply a prefix to. Prior to this change, the interaction was correct with autoconf 2.59, but incorrect with autoconf 2.65.
* s/PRIx64/PRIxPTR/ for uintptr_t printf() argument.Jason Evans2012-03-121-1/+1
|
* Remove bashism.Jason Evans2012-03-121-1/+1
| | | | Submitted by Mike Hommey.
* Remove extra '}'.Jason Evans2012-03-121-1/+0
|
* Implement malloc_vsnprintf().Jason Evans2012-03-0817-570/+958
| | | | | | | | | | | | 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.
* Remove the lg_tcache_gc_sweep option.Jason Evans2012-03-056-58/+12
| | | | | | | 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.
* Use UINT64_C() rather than LLU for 64-bit constants.Jason Evans2012-03-056-27/+29
|
* Add SH4 and mips architecture support.Jason Evans2012-03-052-0/+19
| | | | Submitted by Andreas Vinsander.
* Tweak configure.ac to support cross-compiling.Jason Evans2012-03-051-32/+46
| | | | Submitted by Andreas Vinsander.
* Unify license.Jason Evans2012-03-041-26/+2
| | | | | Update Facebook's software license (with permission from Facebook) to merge with that of the other copyright holders.
* Update copyright dates.Jason Evans2012-03-031-3/+3
|
* Add the --disable-experimental option.Jason Evans2012-03-037-14/+63
|
* Add fine-grained build/install targets.Jason Evans2012-03-032-9/+31
|
* Rename prn to prng.Jason Evans2012-03-026-16/+16
| | | | | Rename prn to prng so that Windows doesn't choke when trying to create a file named prn.h.
* Reorder macros.Jason Evans2012-03-022-6/+6
|
* Add --with-mangling.Jason Evans2012-03-0215-176/+265
| | | | | | | | | | 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.