Skip to content

Commit

Permalink
Remove the *allocm() API, which is superceded by the *allocx() API.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasone committed Apr 15, 2014
1 parent 9b0cbf0 commit 9790b96
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 558 deletions.
3 changes: 0 additions & 3 deletions INSTALL
Expand Up @@ -157,9 +157,6 @@ any of the following arguments (not a definitive list) to 'configure':
--disable-valgrind
Disable support for Valgrind.

--disable-experimental
Disable support for the experimental API (*allocm()).

--disable-zone-allocator
Disable zone allocator for Darwin. This means jemalloc won't be hooked as
the default allocator on OSX/iOS.
Expand Down
7 changes: 1 addition & 6 deletions Makefile.in
Expand Up @@ -48,7 +48,6 @@ cfgoutputs_in := @cfgoutputs_in@
cfgoutputs_out := @cfgoutputs_out@
enable_autogen := @enable_autogen@
enable_code_coverage := @enable_code_coverage@
enable_experimental := @enable_experimental@
enable_zone_allocator := @enable_zone_allocator@
DSO_LDFLAGS = @DSO_LDFLAGS@
SOREV = @SOREV@
Expand Down Expand Up @@ -133,17 +132,13 @@ TESTS_UNIT_AUX := $(srcroot)test/unit/prof_accum_a.c \
TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
$(srcroot)test/integration/allocated.c \
$(srcroot)test/integration/mallocx.c \
$(srcroot)test/integration/MALLOCX_ARENA.c \
$(srcroot)test/integration/mremap.c \
$(srcroot)test/integration/posix_memalign.c \
$(srcroot)test/integration/rallocx.c \
$(srcroot)test/integration/thread_arena.c \
$(srcroot)test/integration/thread_tcache_enabled.c \
$(srcroot)test/integration/xallocx.c
ifeq ($(enable_experimental), 1)
TESTS_INTEGRATION += $(srcroot)test/integration/allocm.c \
$(srcroot)test/integration/MALLOCX_ARENA.c \
$(srcroot)test/integration/rallocm.c
endif
TESTS_STRESS :=
TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_STRESS)

Expand Down
21 changes: 1 addition & 20 deletions configure.ac
Expand Up @@ -44,7 +44,7 @@ AC_CACHE_CHECK([whether $1 is compilable],
dnl ============================================================================

dnl Library revision.
rev=1
rev=2
AC_SUBST([rev])

srcroot=$srcdir
Expand Down Expand Up @@ -438,24 +438,6 @@ AC_CHECK_FUNC([valloc],
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
public_syms="${public_syms} valloc"])

dnl Support the experimental API by default.
AC_ARG_ENABLE([experimental],
[AS_HELP_STRING([--disable-experimental],
[Disable support for the experimental API])],
[if test "x$enable_experimental" = "xno" ; then
enable_experimental="0"
else
enable_experimental="1"
fi
],
[enable_experimental="1"]
)
if test "x$enable_experimental" = "x1" ; then
AC_DEFINE([JEMALLOC_EXPERIMENTAL], [ ])
public_syms="${public_syms} allocm dallocm nallocm rallocm sallocm"
fi
AC_SUBST([enable_experimental])

dnl Do not compute test code coverage by default.
GCOV_FLAGS=
AC_ARG_ENABLE([code-coverage],
Expand Down Expand Up @@ -1465,7 +1447,6 @@ AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
AC_MSG_RESULT([install_suffix : ${install_suffix}])
AC_MSG_RESULT([autogen : ${enable_autogen}])
AC_MSG_RESULT([experimental : ${enable_experimental}])
AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
AC_MSG_RESULT([debug : ${enable_debug}])
AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
Expand Down
191 changes: 2 additions & 189 deletions doc/jemalloc.xml.in
Expand Up @@ -44,11 +44,6 @@
<refname>mallctlbymib</refname>
<refname>malloc_stats_print</refname>
<refname>malloc_usable_size</refname>
<refname>allocm</refname>
<refname>rallocm</refname>
<refname>sallocm</refname>
<refname>dallocm</refname>
<refname>nallocm</refname>
-->
<refpurpose>general purpose memory allocation functions</refpurpose>
</refnamediv>
Expand Down Expand Up @@ -172,41 +167,6 @@
</funcprototype>
<para><type>const char *</type><varname>malloc_conf</varname>;</para>
</refsect2>
<refsect2>
<title>Experimental API</title>
<funcprototype>
<funcdef>int <function>allocm</function></funcdef>
<paramdef>void **<parameter>ptr</parameter></paramdef>
<paramdef>size_t *<parameter>rsize</parameter></paramdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>rallocm</function></funcdef>
<paramdef>void **<parameter>ptr</parameter></paramdef>
<paramdef>size_t *<parameter>rsize</parameter></paramdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
<paramdef>size_t <parameter>extra</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sallocm</function></funcdef>
<paramdef>const void *<parameter>ptr</parameter></paramdef>
<paramdef>size_t *<parameter>rsize</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>dallocm</function></funcdef>
<paramdef>void *<parameter>ptr</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>nallocm</function></funcdef>
<paramdef>size_t *<parameter>rsize</parameter></paramdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
</refsect2>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
Expand Down Expand Up @@ -449,116 +409,6 @@ for (i = 0; i < nbins; i++) {
depended on, since such behavior is entirely implementation-dependent.
</para>
</refsect2>
<refsect2>
<title>Experimental API</title>
<para>The experimental API is subject to change or removal without regard
for backward compatibility. If <option>--disable-experimental</option>
is specified during configuration, the experimental API is
omitted.</para>

<para>The <function>allocm<parameter/></function>,
<function>rallocm<parameter/></function>,
<function>sallocm<parameter/></function>,
<function>dallocm<parameter/></function>, and
<function>nallocm<parameter/></function> functions all have a
<parameter>flags</parameter> argument that can be used to specify
options. The functions only check the options that are contextually
relevant. Use bitwise or (<code language="C">|</code>) operations to
specify one or more of the following:
<variablelist>
<varlistentry>
<term><constant>ALLOCM_LG_ALIGN(<parameter>la</parameter>)
</constant></term>

<listitem><para>Align the memory allocation to start at an address
that is a multiple of <code language="C">(1 &lt;&lt;
<parameter>la</parameter>)</code>. This macro does not validate
that <parameter>la</parameter> is within the valid
range.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>ALLOCM_ALIGN(<parameter>a</parameter>)
</constant></term>

<listitem><para>Align the memory allocation to start at an address
that is a multiple of <parameter>a</parameter>, where
<parameter>a</parameter> is a power of two. This macro does not
validate that <parameter>a</parameter> is a power of 2.
</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>ALLOCM_ZERO</constant></term>

<listitem><para>Initialize newly allocated memory to contain zero
bytes. In the growing reallocation case, the real size prior to
reallocation defines the boundary between untouched bytes and those
that are initialized to contain zero bytes. If this macro is
absent, newly allocated memory is uninitialized.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>ALLOCM_NO_MOVE</constant></term>

<listitem><para>For reallocation, fail rather than moving the
object. This constraint can apply to both growth and
shrinkage.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>ALLOCM_ARENA(<parameter>a</parameter>)
</constant></term>

<listitem><para>Use the arena specified by the index
<parameter>a</parameter> (and by necessity bypass the thread
cache). This macro has no effect for huge regions, nor for regions
that were allocated via an arena other than the one specified.
This macro does not validate that <parameter>a</parameter>
specifies an arena index in the valid range.</para></listitem>
</varlistentry>
</variablelist>
</para>

<para>The <function>allocm<parameter/></function> function allocates at
least <parameter>size</parameter> bytes of memory, sets
<parameter>*ptr</parameter> to the base address of the allocation, and
sets <parameter>*rsize</parameter> to the real size of the allocation if
<parameter>rsize</parameter> is not <constant>NULL</constant>. Behavior
is undefined if <parameter>size</parameter> is <constant>0</constant>, or
if request size overflows due to size class and/or alignment
constraints.</para>

<para>The <function>rallocm<parameter/></function> function resizes the
allocation at <parameter>*ptr</parameter> to be at least
<parameter>size</parameter> bytes, sets <parameter>*ptr</parameter> to
the base address of the allocation if it moved, and sets
<parameter>*rsize</parameter> to the real size of the allocation if
<parameter>rsize</parameter> is not <constant>NULL</constant>. If
<parameter>extra</parameter> is non-zero, an attempt is made to resize
the allocation to be at least <code
language="C">(<parameter>size</parameter> +
<parameter>extra</parameter>)</code> bytes, though inability to allocate
the extra byte(s) will not by itself result in failure. Behavior is
undefined if <parameter>size</parameter> is <constant>0</constant>, if
request size overflows due to size class and/or alignment constraints, or
if <code language="C">(<parameter>size</parameter> +
<parameter>extra</parameter> &gt;
<constant>SIZE_T_MAX</constant>)</code>.</para>

<para>The <function>sallocm<parameter/></function> function sets
<parameter>*rsize</parameter> to the real size of the allocation.</para>

<para>The <function>dallocm<parameter/></function> function causes the
memory referenced by <parameter>ptr</parameter> to be made available for
future allocations.</para>

<para>The <function>nallocm<parameter/></function> function allocates no
memory, but it performs the same size computation as the
<function>allocm<parameter/></function> function, and if
<parameter>rsize</parameter> is not <constant>NULL</constant> it sets
<parameter>*rsize</parameter> to the real size of the allocation that
would result from the equivalent <function>allocm<parameter/></function>
function call. Behavior is undefined if <parameter>size</parameter> is
<constant>0</constant>, or if request size overflows due to size class
and/or alignment constraints.</para>
</refsect2>
</refsect1>
<refsect1 id="tuning">
<title>TUNING</title>
Expand Down Expand Up @@ -1076,9 +926,8 @@ for (i = 0; i < nbins; i++) {
<listitem><para>Zero filling enabled/disabled. If enabled, each byte
of uninitialized allocated memory will be initialized to 0. Note that
this initialization only happens once for each byte, so
<function>realloc<parameter/></function>,
<function>rallocx<parameter/></function> and
<function>rallocm<parameter/></function> calls do not zero memory that
<function>realloc<parameter/></function> and
<function>rallocx<parameter/></function> calls do not zero memory that
was previously allocated. This is intended for debugging and will
impact performance negatively. This option is disabled by default.
</para></listitem>
Expand Down Expand Up @@ -2253,42 +2102,6 @@ malloc_conf = "xmalloc:true";]]></programlisting>
returns the usable size of the allocation pointed to by
<parameter>ptr</parameter>. </para>
</refsect2>
<refsect2>
<title>Experimental API</title>
<para>The <function>allocm<parameter/></function>,
<function>rallocm<parameter/></function>,
<function>sallocm<parameter/></function>,
<function>dallocm<parameter/></function>, and
<function>nallocm<parameter/></function> functions return
<constant>ALLOCM_SUCCESS</constant> on success; otherwise they return an
error value. The <function>allocm<parameter/></function>,
<function>rallocm<parameter/></function>, and
<function>nallocm<parameter/></function> functions will fail if:
<variablelist>
<varlistentry>
<term><errorname>ALLOCM_ERR_OOM</errorname></term>

<listitem><para>Out of memory. Insufficient contiguous memory was
available to service the allocation request. The
<function>allocm<parameter/></function> function additionally sets
<parameter>*ptr</parameter> to <constant>NULL</constant>, whereas
the <function>rallocm<parameter/></function> function leaves
<constant>*ptr</constant> unmodified.</para></listitem>
</varlistentry>
</variablelist>
The <function>rallocm<parameter/></function> function will also
fail if:
<variablelist>
<varlistentry>
<term><errorname>ALLOCM_ERR_NOT_MOVED</errorname></term>

<listitem><para><constant>ALLOCM_NO_MOVE</constant> was specified,
but the reallocation request could not be serviced without moving
the object.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
<refsect1 id="environment">
<title>ENVIRONMENT</title>
Expand Down
1 change: 0 additions & 1 deletion include/jemalloc/internal/jemalloc_internal.h.in
Expand Up @@ -230,7 +230,6 @@ static const bool config_ivsalloc =
#include "jemalloc/internal/jemalloc_internal_macros.h"

#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
#define ALLOCM_LG_ALIGN_MASK ((int)0x3f)

/* Smallest size class to support. */
#define LG_TINY_MIN 3
Expand Down
1 change: 0 additions & 1 deletion include/jemalloc/internal/private_symbols.txt
Expand Up @@ -211,7 +211,6 @@ huge_prof_ctx_set
huge_ralloc
huge_ralloc_no_move
huge_salloc
iallocm
icalloc
icalloct
idalloc
Expand Down
3 changes: 0 additions & 3 deletions include/jemalloc/jemalloc_defs.h.in
@@ -1,9 +1,6 @@
/* Defined if __attribute__((...)) syntax is supported. */
#undef JEMALLOC_HAVE_ATTR

/* Support the experimental API. */
#undef JEMALLOC_EXPERIMENTAL

/*
* Define overrides for non-standard allocator-related functions if they are
* present on the system.
Expand Down
17 changes: 0 additions & 17 deletions include/jemalloc/jemalloc_macros.h.in
Expand Up @@ -19,23 +19,6 @@
/* Bias arena index bits so that 0 encodes "MALLOCX_ARENA() unspecified". */
# define MALLOCX_ARENA(a) ((int)(((a)+1) << 8))

#ifdef JEMALLOC_EXPERIMENTAL
# define ALLOCM_LG_ALIGN(la) (la)
# if LG_SIZEOF_PTR == 2
# define ALLOCM_ALIGN(a) (ffs(a)-1)
# else
# define ALLOCM_ALIGN(a) \
((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
# endif
# define ALLOCM_ZERO ((int)0x40)
# define ALLOCM_NO_MOVE ((int)0x80)
/* Bias arena index bits so that 0 encodes "ALLOCM_ARENA() unspecified". */
# define ALLOCM_ARENA(a) ((int)(((a)+1) << 8))
# define ALLOCM_SUCCESS 0
# define ALLOCM_ERR_OOM 1
# define ALLOCM_ERR_NOT_MOVED 2
#endif

#ifdef JEMALLOC_HAVE_ATTR
# define JEMALLOC_ATTR(s) __attribute__((s))
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
Expand Down
12 changes: 0 additions & 12 deletions include/jemalloc/jemalloc_protos.h.in
Expand Up @@ -44,15 +44,3 @@ JEMALLOC_EXPORT void * @je_@memalign(size_t alignment, size_t size)
#ifdef JEMALLOC_OVERRIDE_VALLOC
JEMALLOC_EXPORT void * @je_@valloc(size_t size) JEMALLOC_ATTR(malloc);
#endif

#ifdef JEMALLOC_EXPERIMENTAL
JEMALLOC_EXPORT int @je_@allocm(void **ptr, size_t *rsize, size_t size,
int flags) JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT int @je_@rallocm(void **ptr, size_t *rsize, size_t size,
size_t extra, int flags) JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT int @je_@sallocm(const void *ptr, size_t *rsize, int flags)
JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT int @je_@dallocm(void *ptr, int flags)
JEMALLOC_ATTR(nonnull(1));
JEMALLOC_EXPORT int @je_@nallocm(size_t *rsize, size_t size, int flags);
#endif

0 comments on commit 9790b96

Please sign in to comment.