svn commit: r234370 - in head: contrib/jemalloc
contrib/jemalloc/doc contrib/jemalloc/include
contrib/jemalloc/include/jemalloc
contrib/jemalloc/include/jemalloc/internal
contrib/jemalloc/src inclu...
Jason Evans
jasone at FreeBSD.org
Tue Apr 17 07:22:15 UTC 2012
Author: jasone
Date: Tue Apr 17 07:22:14 2012
New Revision: 234370
URL: http://svn.freebsd.org/changeset/base/234370
Log:
Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,
prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc.
The code being imported by this commit diverged from
lib/libc/stdlib/malloc.c in March 2010, which means that a portion of
the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries
for all subsequent releases.
Added:
head/contrib/jemalloc/
head/contrib/jemalloc/COPYING
head/contrib/jemalloc/ChangeLog
head/contrib/jemalloc/FREEBSD-Xlist
head/contrib/jemalloc/FREEBSD-diffs
head/contrib/jemalloc/FREEBSD-upgrade (contents, props changed)
head/contrib/jemalloc/VERSION
head/contrib/jemalloc/doc/
head/contrib/jemalloc/doc/jemalloc.3
head/contrib/jemalloc/include/
head/contrib/jemalloc/include/jemalloc/
head/contrib/jemalloc/include/jemalloc/internal/
head/contrib/jemalloc/include/jemalloc/internal/arena.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/atomic.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/base.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/bitmap.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/chunk.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/chunk_dss.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/chunk_mmap.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/ckh.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/ctl.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/extent.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/hash.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/huge.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/mb.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/mutex.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/private_namespace.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/prng.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/prof.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/ql.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/qr.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/quarantine.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/rb.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/rtree.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/size_classes.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/stats.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/tcache.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/tsd.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/internal/util.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/jemalloc.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h (contents, props changed)
head/contrib/jemalloc/include/jemalloc/jemalloc_defs.h (contents, props changed)
head/contrib/jemalloc/src/
head/contrib/jemalloc/src/arena.c (contents, props changed)
head/contrib/jemalloc/src/atomic.c (contents, props changed)
head/contrib/jemalloc/src/base.c (contents, props changed)
head/contrib/jemalloc/src/bitmap.c (contents, props changed)
head/contrib/jemalloc/src/chunk.c (contents, props changed)
head/contrib/jemalloc/src/chunk_dss.c (contents, props changed)
head/contrib/jemalloc/src/chunk_mmap.c (contents, props changed)
head/contrib/jemalloc/src/ckh.c (contents, props changed)
head/contrib/jemalloc/src/ctl.c (contents, props changed)
head/contrib/jemalloc/src/extent.c (contents, props changed)
head/contrib/jemalloc/src/hash.c (contents, props changed)
head/contrib/jemalloc/src/huge.c (contents, props changed)
head/contrib/jemalloc/src/jemalloc.c (contents, props changed)
head/contrib/jemalloc/src/mb.c (contents, props changed)
head/contrib/jemalloc/src/mutex.c (contents, props changed)
head/contrib/jemalloc/src/prof.c (contents, props changed)
head/contrib/jemalloc/src/quarantine.c (contents, props changed)
head/contrib/jemalloc/src/rtree.c (contents, props changed)
head/contrib/jemalloc/src/stats.c (contents, props changed)
head/contrib/jemalloc/src/tcache.c (contents, props changed)
head/contrib/jemalloc/src/tsd.c (contents, props changed)
head/contrib/jemalloc/src/util.c (contents, props changed)
head/lib/libc/stdlib/jemalloc/
head/lib/libc/stdlib/jemalloc/Makefile.inc (contents, props changed)
head/lib/libc/stdlib/jemalloc/Symbol.map (contents, props changed)
head/lib/libc/stdlib/reallocf.3
- copied, changed from r234194, head/lib/libc/stdlib/malloc.3
Deleted:
head/lib/libc/stdlib/aligned_alloc.3
head/lib/libc/stdlib/malloc.3
head/lib/libc/stdlib/malloc.c
head/lib/libc/stdlib/ql.h
head/lib/libc/stdlib/qr.h
head/lib/libc/stdlib/rb.h
Modified:
head/include/malloc_np.h
head/include/stdlib.h
head/lib/libc/Makefile
head/lib/libc/gen/tls.c
head/lib/libc/stdlib/Makefile.inc
head/lib/libc/stdlib/Symbol.map
Added: head/contrib/jemalloc/COPYING
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/COPYING Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,27 @@
+Unless otherwise specified, files in the jemalloc source distribution are
+subject to the following license:
+--------------------------------------------------------------------------------
+Copyright (C) 2002-2012 Jason Evans <jasone at canonware.com>.
+All rights reserved.
+Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
+Copyright (C) 2009-2012 Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice(s),
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice(s),
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--------------------------------------------------------------------------------
Added: head/contrib/jemalloc/ChangeLog
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/ChangeLog Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,322 @@
+Following are change highlights associated with official releases. Important
+bug fixes are all mentioned, but internal enhancements are omitted here for
+brevity (even though they are more fun to write about). Much more detail can be
+found in the git revision history:
+
+ http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git
+ git://canonware.com/jemalloc.git
+
+* 3.0.0 (XXX not yet released)
+
+ Although this version adds some major new features, the primary focus is on
+ internal code cleanup that facilitates maintainability and portability, most
+ of which is not reflected in the ChangeLog. This is the first release to
+ incorporate substantial contributions from numerous other developers, and the
+ result is a more broadly useful allocator (see the git revision history for
+ contribution details). Note that the license has been unified, thanks to
+ Facebook granting a license under the same terms as the other copyright
+ holders (see COPYING).
+
+ New features:
+ - Implement Valgrind support, redzones, and quarantine.
+ - Add support for additional operating systems:
+ + FreeBSD
+ + Mac OS X Lion
+ - Add support for additional architectures:
+ + MIPS
+ + SH4
+ + Tilera
+ - Add support for cross compiling.
+ - Add nallocm(), which rounds a request size up to the nearest size class
+ without actually allocating.
+ - Implement aligned_alloc() (blame C11).
+ - Add the --disable-munmap option, and make it the default on Linux.
+ - Add the --with-mangling option.
+ - Add the --disable-experimental option.
+ - Add the "thread.tcache.enabled" mallctl.
+
+ Incompatible changes:
+ - Enable stats by default.
+ - Enable fill by default.
+ - Disable lazy locking by default.
+ - Rename the "tcache.flush" mallctl to "thread.tcache.flush".
+ - Rename the "arenas.pagesize" mallctl to "arenas.page".
+
+ Removed features:
+ - Remove the swap feature, including the "config.swap", "swap.avail",
+ "swap.prezeroed", "swap.nfds", and "swap.fds" mallctls.
+ - Remove highruns statistics, including the
+ "stats.arenas.<i>.bins.<j>.highruns" and
+ "stats.arenas.<i>.lruns.<j>.highruns" mallctls.
+ - As part of small size class refactoring, remove the "opt.lg_[qc]space_max",
+ "arenas.cacheline", "arenas.subpage", "arenas.[tqcs]space_{min,max}", and
+ "arenas.[tqcs]bins" mallctls.
+ - Remove the "arenas.chunksize" mallctl.
+ - Remove the "opt.lg_prof_tcmax" option.
+ - Remove the "opt.lg_prof_bt_max" option.
+ - Remove the "opt.lg_tcache_gc_sweep" option.
+ - Remove the --disable-tiny option, including the "config.tiny" mallctl.
+ - Remove the --enable-dynamic-page-shift configure option.
+ - Remove the --enable-sysv configure option.
+
+ Bug fixes:
+ - Fix fork-related bugs that could cause deadlock in children between fork
+ and exec.
+ - Fix a statistics-related bug in the "thread.arena" mallctl that could cause
+ invalid statistics and crashes.
+ - Work around TLS dallocation via free() on Linux. This bug could cause
+ write-after-free memory corruption.
+ - Fix malloc_stats_print() to honor 'b' and 'l' in the opts parameter.
+ - Fix realloc(p, 0) to act like free(p).
+ - Do not enforce minimum alignment in memalign().
+ - Check for NULL pointer in malloc_usable_size().
+ - Fix bin->runcur management to fix a layout policy bug. This bug did not
+ affect correctness.
+ - Fix a bug in choose_arena_hard() that potentially caused more arenas to be
+ initialized than necessary.
+ - Add missing "opt.lg_tcache_max" mallctl implementation.
+ - Use glibc allocator hooks to make mixed allocator usage less likely.
+ - Fix build issues for --disable-tcache.
+
+* 2.2.5 (November 14, 2011)
+
+ Bug fixes:
+ - Fix huge_ralloc() race when using mremap(2). This is a serious bug that
+ could cause memory corruption and/or crashes.
+ - Fix huge_ralloc() to maintain chunk statistics.
+ - Fix malloc_stats_print(..., "a") output.
+
+* 2.2.4 (November 5, 2011)
+
+ Bug fixes:
+ - Initialize arenas_tsd before using it. This bug existed for 2.2.[0-3], as
+ well as for --disable-tls builds in earlier releases.
+ - Do not assume a 4 KiB page size in test/rallocm.c.
+
+* 2.2.3 (August 31, 2011)
+
+ This version fixes numerous bugs related to heap profiling.
+
+ Bug fixes:
+ - Fix a prof-related race condition. This bug could cause memory corruption,
+ but only occurred in non-default configurations (prof_accum:false).
+ - Fix off-by-one backtracing issues (make sure that prof_alloc_prep() is
+ excluded from backtraces).
+ - Fix a prof-related bug in realloc() (only triggered by OOM errors).
+ - Fix prof-related bugs in allocm() and rallocm().
+ - Fix prof_tdata_cleanup() for --disable-tls builds.
+ - Fix a relative include path, to fix objdir builds.
+
+* 2.2.2 (July 30, 2011)
+
+ Bug fixes:
+ - Fix a build error for --disable-tcache.
+ - Fix assertions in arena_purge() (for real this time).
+ - Add the --with-private-namespace option. This is a workaround for symbol
+ conflicts that can inadvertently arise when using static libraries.
+
+* 2.2.1 (March 30, 2011)
+
+ Bug fixes:
+ - Implement atomic operations for x86/x64. This fixes compilation failures
+ for versions of gcc that are still in wide use.
+ - Fix an assertion in arena_purge().
+
+* 2.2.0 (March 22, 2011)
+
+ This version incorporates several improvements to algorithms and data
+ structures that tend to reduce fragmentation and increase speed.
+
+ New features:
+ - Add the "stats.cactive" mallctl.
+ - Update pprof (from google-perftools 1.7).
+ - Improve backtracing-related configuration logic, and add the
+ --disable-prof-libgcc option.
+
+ Bug fixes:
+ - Change default symbol visibility from "internal", to "hidden", which
+ decreases the overhead of library-internal function calls.
+ - Fix symbol visibility so that it is also set on OS X.
+ - Fix a build dependency regression caused by the introduction of the .pic.o
+ suffix for PIC object files.
+ - Add missing checks for mutex initialization failures.
+ - Don't use libgcc-based backtracing except on x64, where it is known to work.
+ - Fix deadlocks on OS X that were due to memory allocation in
+ pthread_mutex_lock().
+ - Heap profiling-specific fixes:
+ + Fix memory corruption due to integer overflow in small region index
+ computation, when using a small enough sample interval that profiling
+ context pointers are stored in small run headers.
+ + Fix a bootstrap ordering bug that only occurred with TLS disabled.
+ + Fix a rallocm() rsize bug.
+ + Fix error detection bugs for aligned memory allocation.
+
+* 2.1.3 (March 14, 2011)
+
+ Bug fixes:
+ - Fix a cpp logic regression (due to the "thread.{de,}allocatedp" mallctl fix
+ for OS X in 2.1.2).
+ - Fix a "thread.arena" mallctl bug.
+ - Fix a thread cache stats merging bug.
+
+* 2.1.2 (March 2, 2011)
+
+ Bug fixes:
+ - Fix "thread.{de,}allocatedp" mallctl for OS X.
+ - Add missing jemalloc.a to build system.
+
+* 2.1.1 (January 31, 2011)
+
+ Bug fixes:
+ - Fix aligned huge reallocation (affected allocm()).
+ - Fix the ALLOCM_LG_ALIGN macro definition.
+ - Fix a heap dumping deadlock.
+ - Fix a "thread.arena" mallctl bug.
+
+* 2.1.0 (December 3, 2010)
+
+ This version incorporates some optimizations that can't quite be considered
+ bug fixes.
+
+ New features:
+ - Use Linux's mremap(2) for huge object reallocation when possible.
+ - Avoid locking in mallctl*() when possible.
+ - Add the "thread.[de]allocatedp" mallctl's.
+ - Convert the manual page source from roff to DocBook, and generate both roff
+ and HTML manuals.
+
+ Bug fixes:
+ - Fix a crash due to incorrect bootstrap ordering. This only impacted
+ --enable-debug --enable-dss configurations.
+ - Fix a minor statistics bug for mallctl("swap.avail", ...).
+
+* 2.0.1 (October 29, 2010)
+
+ Bug fixes:
+ - Fix a race condition in heap profiling that could cause undefined behavior
+ if "opt.prof_accum" were disabled.
+ - Add missing mutex unlocks for some OOM error paths in the heap profiling
+ code.
+ - Fix a compilation error for non-C99 builds.
+
+* 2.0.0 (October 24, 2010)
+
+ This version focuses on the experimental *allocm() API, and on improved
+ run-time configuration/introspection. Nonetheless, numerous performance
+ improvements are also included.
+
+ New features:
+ - Implement the experimental {,r,s,d}allocm() API, which provides a superset
+ of the functionality available via malloc(), calloc(), posix_memalign(),
+ realloc(), malloc_usable_size(), and free(). These functions can be used to
+ allocate/reallocate aligned zeroed memory, ask for optional extra memory
+ during reallocation, prevent object movement during reallocation, etc.
+ - Replace JEMALLOC_OPTIONS/JEMALLOC_PROF_PREFIX with MALLOC_CONF, which is
+ more human-readable, and more flexible. For example:
+ JEMALLOC_OPTIONS=AJP
+ is now:
+ MALLOC_CONF=abort:true,fill:true,stats_print:true
+ - Port to Apple OS X. Sponsored by Mozilla.
+ - Make it possible for the application to control thread-->arena mappings via
+ the "thread.arena" mallctl.
+ - Add compile-time support for all TLS-related functionality via pthreads TSD.
+ This is mainly of interest for OS X, which does not support TLS, but has a
+ TSD implementation with similar performance.
+ - Override memalign() and valloc() if they are provided by the system.
+ - Add the "arenas.purge" mallctl, which can be used to synchronously purge all
+ dirty unused pages.
+ - Make cumulative heap profiling data optional, so that it is possible to
+ limit the amount of memory consumed by heap profiling data structures.
+ - Add per thread allocation counters that can be accessed via the
+ "thread.allocated" and "thread.deallocated" mallctls.
+
+ Incompatible changes:
+ - Remove JEMALLOC_OPTIONS and malloc_options (see MALLOC_CONF above).
+ - Increase default backtrace depth from 4 to 128 for heap profiling.
+ - Disable interval-based profile dumps by default.
+
+ Bug fixes:
+ - Remove bad assertions in fork handler functions. These assertions could
+ cause aborts for some combinations of configure settings.
+ - Fix strerror_r() usage to deal with non-standard semantics in GNU libc.
+ - Fix leak context reporting. This bug tended to cause the number of contexts
+ to be underreported (though the reported number of objects and bytes were
+ correct).
+ - Fix a realloc() bug for large in-place growing reallocation. This bug could
+ cause memory corruption, but it was hard to trigger.
+ - Fix an allocation bug for small allocations that could be triggered if
+ multiple threads raced to create a new run of backing pages.
+ - Enhance the heap profiler to trigger samples based on usable size, rather
+ than request size.
+ - Fix a heap profiling bug due to sometimes losing track of requested object
+ size for sampled objects.
+
+* 1.0.3 (August 12, 2010)
+
+ Bug fixes:
+ - Fix the libunwind-based implementation of stack backtracing (used for heap
+ profiling). This bug could cause zero-length backtraces to be reported.
+ - Add a missing mutex unlock in library initialization code. If multiple
+ threads raced to initialize malloc, some of them could end up permanently
+ blocked.
+
+* 1.0.2 (May 11, 2010)
+
+ Bug fixes:
+ - Fix junk filling of large objects, which could cause memory corruption.
+ - Add MAP_NORESERVE support for chunk mapping, because otherwise virtual
+ memory limits could cause swap file configuration to fail. Contributed by
+ Jordan DeLong.
+
+* 1.0.1 (April 14, 2010)
+
+ Bug fixes:
+ - Fix compilation when --enable-fill is specified.
+ - Fix threads-related profiling bugs that affected accuracy and caused memory
+ to be leaked during thread exit.
+ - Fix dirty page purging race conditions that could cause crashes.
+ - Fix crash in tcache flushing code during thread destruction.
+
+* 1.0.0 (April 11, 2010)
+
+ This release focuses on speed and run-time introspection. Numerous
+ algorithmic improvements make this release substantially faster than its
+ predecessors.
+
+ New features:
+ - Implement autoconf-based configuration system.
+ - Add mallctl*(), for the purposes of introspection and run-time
+ configuration.
+ - Make it possible for the application to manually flush a thread's cache, via
+ the "tcache.flush" mallctl.
+ - Base maximum dirty page count on proportion of active memory.
+ - Compute various addtional run-time statistics, including per size class
+ statistics for large objects.
+ - Expose malloc_stats_print(), which can be called repeatedly by the
+ application.
+ - Simplify the malloc_message() signature to only take one string argument,
+ and incorporate an opaque data pointer argument for use by the application
+ in combination with malloc_stats_print().
+ - Add support for allocation backed by one or more swap files, and allow the
+ application to disable over-commit if swap files are in use.
+ - Implement allocation profiling and leak checking.
+
+ Removed features:
+ - Remove the dynamic arena rebalancing code, since thread-specific caching
+ reduces its utility.
+
+ Bug fixes:
+ - Modify chunk allocation to work when address space layout randomization
+ (ASLR) is in use.
+ - Fix thread cleanup bugs related to TLS destruction.
+ - Handle 0-size allocation requests in posix_memalign().
+ - Fix a chunk leak. The leaked chunks were never touched, so this impacted
+ virtual memory usage, but not physical memory usage.
+
+* linux_2008082[78]a (August 27/28, 2008)
+
+ These snapshot releases are the simple result of incorporating Linux-specific
+ support into the FreeBSD malloc sources.
+
+--------------------------------------------------------------------------------
+vim:filetype=text:textwidth=80
Added: head/contrib/jemalloc/FREEBSD-Xlist
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/FREEBSD-Xlist Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,23 @@
+$FreeBSD$
+.git
+.gitignore
+FREEBSD-*
+INSTALL
+Makefile*
+README
+autogen.sh
+autom4te.cache/
+bin/
+config.*
+configure*
+doc/*.in
+doc/*.xml
+doc/*.xsl
+doc/*.html
+include/jemalloc/internal/jemalloc_internal.h.in
+include/jemalloc/internal/size_classes.sh
+include/jemalloc/jemalloc.h.in
+include/jemalloc/jemalloc_defs.h.in
+install-sh
+src/zone.c
+test/
Added: head/contrib/jemalloc/FREEBSD-diffs
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/FREEBSD-diffs Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,247 @@
+diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
+index 98d0ba4..23d2152 100644
+--- a/doc/jemalloc.xml.in
++++ b/doc/jemalloc.xml.in
+@@ -51,12 +51,23 @@
+ <para>This manual describes jemalloc @jemalloc_version at . More information
+ can be found at the <ulink
+ url="http://www.canonware.com/jemalloc/">jemalloc website</ulink>.</para>
++
++ <para>The following configuration options are enabled in libc's built-in
++ jemalloc: <option>--enable-dss</option>,
++ <option>--enable-experimental</option>, <option>--enable-fill</option>,
++ <option>--enable-lazy-lock</option>, <option>--enable-munmap</option>,
++ <option>--enable-stats</option>, <option>--enable-tcache</option>,
++ <option>--enable-tls</option>, <option>--enable-utrace</option>, and
++ <option>--enable-xmalloc</option>. Additionally,
++ <option>--enable-debug</option> is enabled in development versions of
++ FreeBSD (controlled by the <constant>MALLOC_PRODUCTION</constant> make
++ variable).</para>
+ </refsect1>
+ <refsynopsisdiv>
+ <title>SYNOPSIS</title>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include <<filename class="headerfile">stdlib.h</filename>>
+-#include <<filename class="headerfile">jemalloc/jemalloc.h</filename>></funcsynopsisinfo>
++#include <<filename class="headerfile">malloc_np.h</filename>></funcsynopsisinfo>
+ <refsect2>
+ <title>Standard API</title>
+ <funcprototype>
+@@ -2080,4 +2091,16 @@ malloc_conf = "lg_chunk:24";]]></programlisting></para>
+ <para>The <function>posix_memalign<parameter/></function> function conforms
+ to IEEE Std 1003.1-2001 (“POSIX.1”).</para>
+ </refsect1>
++ <refsect1 id="history">
++ <title>HISTORY</title>
++ <para>The <function>malloc_usable_size<parameter/></function> and
++ <function>posix_memalign<parameter/></function> functions first appeared in
++ FreeBSD 7.0.</para>
++
++ <para>The <function>aligned_alloc<parameter/></function>,
++ <function>malloc_stats_print<parameter/></function>,
++ <function>mallctl*<parameter/></function>, and
++ <function>*allocm<parameter/></function> functions first appeared in
++ FreeBSD 10.0.</para>
++ </refsect1>
+ </refentry>
+diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
+index aa21aa5..e0f5fed 100644
+--- a/include/jemalloc/internal/jemalloc_internal.h.in
++++ b/include/jemalloc/internal/jemalloc_internal.h.in
+@@ -1,3 +1,6 @@
++#include "libc_private.h"
++#include "namespace.h"
++
+ #include <sys/mman.h>
+ #include <sys/param.h>
+ #include <sys/syscall.h>
+@@ -33,6 +36,9 @@
+ #include <pthread.h>
+ #include <math.h>
+
++#include "un-namespace.h"
++#include "libc_private.h"
++
+ #define JEMALLOC_NO_DEMANGLE
+ #include "../jemalloc at install_suffix@.h"
+
+diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h
+index c46feee..d7133f4 100644
+--- a/include/jemalloc/internal/mutex.h
++++ b/include/jemalloc/internal/mutex.h
+@@ -39,8 +39,6 @@ struct malloc_mutex_s {
+
+ #ifdef JEMALLOC_LAZY_LOCK
+ extern bool isthreaded;
+-#else
+-# define isthreaded true
+ #endif
+
+ bool malloc_mutex_init(malloc_mutex_t *mutex);
+diff --git a/include/jemalloc/jemalloc.h.in b/include/jemalloc/jemalloc.h.in
+index f0581db..f26d8bc 100644
+--- a/include/jemalloc/jemalloc.h.in
++++ b/include/jemalloc/jemalloc.h.in
+@@ -15,6 +15,7 @@ extern "C" {
+ #define JEMALLOC_VERSION_GID "@jemalloc_version_gid@"
+
+ #include "jemalloc_defs at install_suffix@.h"
++#include "jemalloc_FreeBSD.h"
+
+ #ifdef JEMALLOC_EXPERIMENTAL
+ #define ALLOCM_LG_ALIGN(la) (la)
+diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jemalloc_FreeBSD.h
+new file mode 100644
+index 0000000..2c5797f
+--- /dev/null
++++ b/include/jemalloc/jemalloc_FreeBSD.h
+@@ -0,0 +1,76 @@
++/*
++ * Override settings that were generated in jemalloc_defs.h as necessary.
++ */
++
++#undef JEMALLOC_OVERRIDE_VALLOC
++
++#ifndef MALLOC_PRODUCTION
++#define JEMALLOC_DEBUG
++#endif
++
++/*
++ * The following are architecture-dependent, so conditionally define them for
++ * each supported architecture.
++ */
++#undef CPU_SPINWAIT
++#undef JEMALLOC_TLS_MODEL
++#undef STATIC_PAGE_SHIFT
++#undef LG_SIZEOF_PTR
++#undef LG_SIZEOF_INT
++#undef LG_SIZEOF_LONG
++#undef LG_SIZEOF_INTMAX_T
++
++#ifdef __i386__
++# define LG_SIZEOF_PTR 2
++# define CPU_SPINWAIT __asm__ volatile("pause")
++# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
++#endif
++#ifdef __ia64__
++# define LG_SIZEOF_PTR 3
++#endif
++#ifdef __sparc64__
++# define LG_SIZEOF_PTR 3
++# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
++#endif
++#ifdef __amd64__
++# define LG_SIZEOF_PTR 3
++# define CPU_SPINWAIT __asm__ volatile("pause")
++# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
++#endif
++#ifdef __arm__
++# define LG_SIZEOF_PTR 2
++#endif
++#ifdef __mips__
++# define LG_SIZEOF_PTR 2
++#endif
++#ifdef __powerpc64__
++# define LG_SIZEOF_PTR 3
++#elif defined(__powerpc__)
++# define LG_SIZEOF_PTR 2
++#endif
++
++#ifndef JEMALLOC_TLS_MODEL
++# define JEMALLOC_TLS_MODEL /* Default. */
++#endif
++#ifdef __clang__
++# undef JEMALLOC_TLS_MODEL
++# define JEMALLOC_TLS_MODEL /* clang does not support tls_model yet. */
++#endif
++
++#define STATIC_PAGE_SHIFT PAGE_SHIFT
++#define LG_SIZEOF_INT 2
++#define LG_SIZEOF_LONG LG_SIZEOF_PTR
++#define LG_SIZEOF_INTMAX_T 3
++
++/* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
++#undef JEMALLOC_LAZY_LOCK
++extern int __isthreaded;
++#define isthreaded ((bool)__isthreaded)
++
++/* Mangle. */
++#define open _open
++#define read _read
++#define write _write
++#define close _close
++#define pthread_mutex_lock _pthread_mutex_lock
++#define pthread_mutex_unlock _pthread_mutex_unlock
+diff --git a/src/jemalloc.c b/src/jemalloc.c
+index 0decd8a..73fad29 100644
+--- a/src/jemalloc.c
++++ b/src/jemalloc.c
+@@ -8,6 +8,9 @@ malloc_tsd_data(, arenas, arena_t *, NULL)
+ malloc_tsd_data(, thread_allocated, thread_allocated_t,
+ THREAD_ALLOCATED_INITIALIZER)
+
++const char *__malloc_options_1_0;
++__sym_compat(_malloc_options, __malloc_options_1_0, FBSD_1.0);
++
+ /* Runtime configuration options. */
+ const char *je_malloc_conf JEMALLOC_ATTR(visibility("default"));
+ #ifdef JEMALLOC_DEBUG
+@@ -401,7 +404,8 @@ malloc_conf_init(void)
+ #endif
+ ;
+
+- if ((opts = getenv(envname)) != NULL) {
++ if (issetugid() == 0 && (opts = getenv(envname)) !=
++ NULL) {
+ /*
+ * Do nothing; opts is already initialized to
+ * the value of the MALLOC_CONF environment
+diff --git a/src/mutex.c b/src/mutex.c
+index 4b8ce57..7be5fc9 100644
+--- a/src/mutex.c
++++ b/src/mutex.c
+@@ -63,6 +63,17 @@ pthread_create(pthread_t *__restrict thread,
+ #ifdef JEMALLOC_MUTEX_INIT_CB
+ int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
+ void *(calloc_cb)(size_t, size_t));
++
++__weak_reference(_pthread_mutex_init_calloc_cb_stub,
++ _pthread_mutex_init_calloc_cb);
++
++int
++_pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex,
++ void *(calloc_cb)(size_t, size_t))
++{
++
++ return (0);
++}
+ #endif
+
+ bool
+diff --git a/src/util.c b/src/util.c
+index 2aab61f..8b05042 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -60,6 +60,22 @@ wrtmessage(void *cbopaque, const char *s)
+ void (*je_malloc_message)(void *, const char *s)
+ JEMALLOC_ATTR(visibility("default")) = wrtmessage;
+
++JEMALLOC_CATTR(visibility("hidden"), static)
++void
++wrtmessage_1_0(const char *s1, const char *s2, const char *s3,
++ const char *s4)
++{
++
++ wrtmessage(NULL, s1);
++ wrtmessage(NULL, s2);
++ wrtmessage(NULL, s3);
++ wrtmessage(NULL, s4);
++}
++
++void (*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3,
++ const char *s4) = wrtmessage_1_0;
++__sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0);
++
+ /*
+ * glibc provides a non-standard strerror_r() when _GNU_SOURCE is defined, so
+ * provide a wrapper.
Added: head/contrib/jemalloc/FREEBSD-upgrade
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/FREEBSD-upgrade Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,122 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# Usage: cd /usr/src/contrib/jemalloc
+# ./FREEBSD-upgrade <command> [args]
+#
+# At least the following ports are required when importing jemalloc:
+# - devel/autoconf
+# - devel/git
+# - devel/gmake
+# - textproc/docbook-xsl
+#
+# The normal workflow for importing a new release is:
+#
+# cd /usr/src/contrib/jemalloc
+#
+# Merge local changes that were made since the previous import:
+#
+# ./FREEBSD-upgrade merge-changes
+# ./FREEBSD-upgrade rediff
+#
+# Extract latest jemalloc release.
+#
+# ./FREEBSD-upgrade extract
+#
+# Fix patch conflicts as necessary, then regenerate diffs to update line
+# offsets:
+#
+# ./FREEBSD-upgrade rediff
+# ./FREEBSD-upgrade extract
+#
+# Do multiple buildworld/installworld rounds. If problems arise and patches
+# are needed, edit the code in ${work} as necessary, then:
+#
+# ./FREEBSD-upgrade rediff
+# ./FREEBSD-upgrade extract
+#
+# The rediff/extract order is important because rediff saves the local
+# changes, then extract blows away the work tree and re-creates it with the
+# diffs applied.
+#
+# Finally, to clean up:
+#
+# ./FREEBSD-upgrade clean
+
+set -e
+
+if [ ! -x "FREEBSD-upgrade" ] ; then
+ echo "Run from within src/contrib/jemalloc/" >&2
+ exit 1
+fi
+
+src=`pwd`
+workname="jemalloc.git"
+work="${src}/../${workname}" # merge-changes expects ${workname} in "..".
+changes="${src}/FREEBSD-changes"
+
+do_extract() {
+ local rev=$1
+ # Clone.
+ rm -rf ${work}
+ git clone git://canonware.com/jemalloc.git ${work}
+ (
+ cd ${work}
+ if [ "x${rev}" != "x" ] ; then
+ # Use optional rev argument to check out a revision other than HEAD on
+ # master.
+ git checkout ${rev}
+ fi
+ # Apply diffs before generating files.
+ patch -p1 < "${src}/FREEBSD-diffs"
+ find . -name '*.orig' -delete
+ # Generate various files.
+ ./autogen.sh --enable-cc-silence --enable-dss --enable-xmalloc \
+ --enable-utrace --with-xslroot=/usr/local/share/xsl/docbook
+ gmake dist
+ )
+}
+
+do_diff() {
+ (cd ${work}; git add -A; git diff --cached) > FREEBSD-diffs
+}
+
+command=$1
+shift
+case "${command}" in
+ merge-changes) # Merge local changes that were made since the previous import.
+ rev=`cat VERSION |tr 'g' ' ' |awk '{print $2}'`
+ # Extract code corresponding to most recent import.
+ do_extract ${rev}
+ # Compute local differences to the upstream+patches and apply them.
+ (
+ cd ..
+ diff -ru -X ${src}/FREEBSD-Xlist ${workname} jemalloc > ${changes} || true
+ )
+ (
+ cd ${work}
+ patch -p1 < ${changes}
+ find . -name '*.orig' -delete
+ )
+ # Update diff.
+ do_diff
+ ;;
+ extract) # Extract upstream sources, apply patches, copy to contrib/jemalloc.
+ rev=$1
+ do_extract ${rev}
+ # Delete existing files so that cruft doesn't silently remain.
+ rm -rf ChangeLog COPYING VERSION doc include src
+ # Copy files over.
+ tar cf - -C ${work} -X FREEBSD-Xlist . |tar xvf -
+ ;;
+ rediff) # Regenerate diffs based on working tree.
+ do_diff
+ ;;
+ clean) # Remove working tree and temporary files.
+ rm -rf ${work} ${changes}
+ ;;
+ *)
+ echo "Unsupported command: \"${command}\"" >&2
+ exit 1
+ ;;
+esac
Added: head/contrib/jemalloc/VERSION
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/VERSION Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1 @@
+1.0.0-258-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa
Added: head/contrib/jemalloc/doc/jemalloc.3
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/jemalloc/doc/jemalloc.3 Tue Apr 17 07:22:14 2012 (r234370)
@@ -0,0 +1,1464 @@
+'\" t
+.\" Title: JEMALLOC
+.\" Author: Jason Evans
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 04/16/2012
+.\" Manual: User Manual
+.\" Source: jemalloc 1.0.0-258-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa
+.\" Language: English
+.\"
+.TH "JEMALLOC" "3" "04/16/2012" "jemalloc 1.0.0-258-g9ef7f5dc34" "User Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+jemalloc \- general purpose memory allocation functions
+.SH "LIBRARY"
+.PP
+This manual describes jemalloc 1\&.0\&.0\-258\-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa\&. More information can be found at the
+\m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
+.PP
+The following configuration options are enabled in libc\*(Aqs built\-in jemalloc:
+\fB\-\-enable\-dss\fR,
+\fB\-\-enable\-experimental\fR,
+\fB\-\-enable\-fill\fR,
+\fB\-\-enable\-lazy\-lock\fR,
+\fB\-\-enable\-munmap\fR,
+\fB\-\-enable\-stats\fR,
+\fB\-\-enable\-tcache\fR,
+\fB\-\-enable\-tls\fR,
+\fB\-\-enable\-utrace\fR, and
+\fB\-\-enable\-xmalloc\fR\&. Additionally,
+\fB\-\-enable\-debug\fR
+is enabled in development versions of FreeBSD (controlled by the
+\fBMALLOC_PRODUCTION\fR
+make variable)\&.
+.SH "SYNOPSIS"
+.sp
+.ft B
+.nf
+#include <stdlib\&.h>
+#include <malloc_np\&.h>
+.fi
+.ft
+.SS "Standard API"
+.HP \w'void\ *malloc('u
+.BI "void *malloc(size_t\ " "size" ");"
+.HP \w'void\ *calloc('u
+.BI "void *calloc(size_t\ " "number" ", size_t\ " "size" ");"
+.HP \w'int\ posix_memalign('u
+.BI "int posix_memalign(void\ **" "ptr" ", size_t\ " "alignment" ", size_t\ " "size" ");"
+.HP \w'void\ *aligned_alloc('u
+.BI "void *aligned_alloc(size_t\ " "alignment" ", size_t\ " "size" ");"
+.HP \w'void\ *realloc('u
+.BI "void *realloc(void\ *" "ptr" ", size_t\ " "size" ");"
+.HP \w'void\ free('u
+.BI "void free(void\ *" "ptr" ");"
+.SS "Non\-standard API"
+.HP \w'size_t\ malloc_usable_size('u
+.BI "size_t malloc_usable_size(const\ void\ *" "ptr" ");"
+.HP \w'void\ malloc_stats_print('u
+.BI "void malloc_stats_print(void\ " "(*write_cb)" "\ (void\ *,\ const\ char\ *), void\ *" "cbopaque" ", const\ char\ *" "opts" ");"
+.HP \w'int\ mallctl('u
+.BI "int mallctl(const\ char\ *" "name" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
+.HP \w'int\ mallctlnametomib('u
+.BI "int mallctlnametomib(const\ char\ *" "name" ", size_t\ *" "mibp" ", size_t\ *" "miblenp" ");"
+.HP \w'int\ mallctlbymib('u
+.BI "int mallctlbymib(const\ size_t\ *" "mib" ", size_t\ " "miblen" ", void\ *" "oldp" ", size_t\ *" "oldlenp" ", void\ *" "newp" ", size_t\ " "newlen" ");"
+.HP \w'void\ (*malloc_message)('u
+.BI "void (*malloc_message)(void\ *" "cbopaque" ", const\ char\ *" "s" ");"
+.PP
+const char *\fImalloc_conf\fR;
+.SS "Experimental API"
+.HP \w'int\ allocm('u
+.BI "int allocm(void\ **" "ptr" ", size_t\ *" "rsize" ", size_t\ " "size" ", int\ " "flags" ");"
+.HP \w'int\ rallocm('u
+.BI "int rallocm(void\ **" "ptr" ", size_t\ *" "rsize" ", size_t\ " "size" ", size_t\ " "extra" ", int\ " "flags" ");"
+.HP \w'int\ sallocm('u
+.BI "int sallocm(const\ void\ *" "ptr" ", size_t\ *" "rsize" ", int\ " "flags" ");"
+.HP \w'int\ dallocm('u
+.BI "int dallocm(void\ *" "ptr" ", int\ " "flags" ");"
+.HP \w'int\ nallocm('u
+.BI "int nallocm(size_t\ *" "rsize" ", size_t\ " "size" ", int\ " "flags" ");"
+.SH "DESCRIPTION"
+.SS "Standard API"
+.PP
+The
+\fBmalloc\fR\fB\fR
+function allocates
+\fIsize\fR
+bytes of uninitialized memory\&. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object\&.
+.PP
+The
+\fBcalloc\fR\fB\fR
+function allocates space for
+\fInumber\fR
+objects, each
+\fIsize\fR
+bytes in length\&. The result is identical to calling
+\fBmalloc\fR\fB\fR
+with an argument of
+\fInumber\fR
+*
+\fIsize\fR, with the exception that the allocated memory is explicitly initialized to zero bytes\&.
+.PP
+The
+\fBposix_memalign\fR\fB\fR
+function allocates
+\fIsize\fR
+bytes of memory such that the allocation\*(Aqs base address is an even multiple of
+\fIalignment\fR, and returns the allocation in the value pointed to by
+\fIptr\fR\&. The requested
+\fIalignment\fR
+must be a power of 2 at least as large as
+sizeof(\fBvoid *\fR)\&.
+.PP
+The
+\fBaligned_alloc\fR\fB\fR
+function allocates
+\fIsize\fR
+bytes of memory such that the allocation\*(Aqs base address is an even multiple of
+\fIalignment\fR\&. The requested
+\fIalignment\fR
+must be a power of 2\&. Behavior is undefined if
+\fIsize\fR
+is not an integral multiple of
+\fIalignment\fR\&.
+.PP
+The
+\fBrealloc\fR\fB\fR
+function changes the size of the previously allocated memory referenced by
+\fIptr\fR
+to
+\fIsize\fR
+bytes\&. The contents of the memory are unchanged up to the lesser of the new and old sizes\&. If the new size is larger, the contents of the newly allocated portion of the memory are undefined\&. Upon success, the memory referenced by
+\fIptr\fR
+is freed and a pointer to the newly allocated memory is returned\&. Note that
+\fBrealloc\fR\fB\fR
+may move the memory allocation, resulting in a different return value than
+\fIptr\fR\&. If
+\fIptr\fR
+is
+\fBNULL\fR, the
+\fBrealloc\fR\fB\fR
+function behaves identically to
+\fBmalloc\fR\fB\fR
+for the specified size\&.
+.PP
+The
+\fBfree\fR\fB\fR
+function causes the allocated memory referenced by
+\fIptr\fR
+to be made available for future allocations\&. If
+\fIptr\fR
+is
+\fBNULL\fR, no action occurs\&.
+.SS "Non\-standard API"
+.PP
+The
+\fBmalloc_usable_size\fR\fB\fR
+function returns the usable size of the allocation pointed to by
+\fIptr\fR\&. The return value may be larger than the size that was requested during allocation\&. The
+\fBmalloc_usable_size\fR\fB\fR
+function is not a mechanism for in\-place
+\fBrealloc\fR\fB\fR; rather it is provided solely as a tool for introspection purposes\&. Any discrepancy between the requested allocation size and the size reported by
+\fBmalloc_usable_size\fR\fB\fR
+should not be depended on, since such behavior is entirely implementation\-dependent\&.
+.PP
+The
+\fBmalloc_stats_print\fR\fB\fR
+function writes human\-readable summary statistics via the
+\fIwrite_cb\fR
+callback function pointer and
+\fIcbopaque\fR
+data passed to
+\fIwrite_cb\fR, or
+\fBmalloc_message\fR\fB\fR
+if
+\fIwrite_cb\fR
+is
+\fBNULL\fR\&. This function can be called repeatedly\&. General information that never changes during execution can be omitted by specifying "g" as a character within the
+\fIopts\fR
+string\&. Note that
+\fBmalloc_message\fR\fB\fR
+uses the
+\fBmallctl*\fR\fB\fR
+functions internally, so inconsistent statistics can be reported if multiple threads use these functions simultaneously\&. If
+\fB\-\-enable\-stats\fR
+is specified during configuration, \(lqm\(rq and \(lqa\(rq can be specified to omit merged arena and per arena statistics, respectively; \(lqb\(rq and \(lql\(rq can be specified to omit per size class statistics for bins and large objects, respectively\&. Unrecognized characters are silently ignored\&. Note that thread caching may prevent some statistics from being completely up to date, since extra locking would be required to merge counters that track thread cache operations\&.
+.PP
+The
+\fBmallctl\fR\fB\fR
+function provides a general interface for introspecting the memory allocator, as well as setting modifiable parameters and triggering actions\&. The period\-separated
+\fIname\fR
+argument specifies a location in a tree\-structured namespace; see the
+MALLCTL NAMESPACE
+section for documentation on the tree contents\&. To read a value, pass a pointer via
+\fIoldp\fR
+to adequate space to contain the value, and a pointer to its length via
+\fIoldlenp\fR; otherwise pass
+\fBNULL\fR
+and
+\fBNULL\fR\&. Similarly, to write a value, pass a pointer to the value via
+\fInewp\fR, and its length via
+\fInewlen\fR; otherwise pass
+\fBNULL\fR
+and
+\fB0\fR\&.
+.PP
+The
+\fBmallctlnametomib\fR\fB\fR
+function provides a way to avoid repeated name lookups for applications that repeatedly query the same portion of the namespace, by translating a name to a \(lqManagement Information Base\(rq (MIB) that can be passed repeatedly to
+\fBmallctlbymib\fR\fB\fR\&. Upon successful return from
+\fBmallctlnametomib\fR\fB\fR,
+\fImibp\fR
+contains an array of
+\fI*miblenp\fR
+integers, where
+\fI*miblenp\fR
+is the lesser of the number of components in
+\fIname\fR
+and the input value of
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list