<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/malloc.3, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,</title>
<updated>2012-04-17T07:22:14+00:00</updated>
<author>
<name>Jason Evans</name>
<email>jasone@FreeBSD.org</email>
</author>
<published>2012-04-17T07:22:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a4bd5210d5e680818a9319a76ebf71caef95bcd3'/>
<id>a4bd5210d5e680818a9319a76ebf71caef95bcd3</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Correct a typo in the malloc(3) manpage.  Malloc options are set in the</title>
<updated>2011-03-07T15:19:17+00:00</updated>
<author>
<name>Ryan Stone</name>
<email>rstone@FreeBSD.org</email>
</author>
<published>2011-03-07T15:19:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f88f24de4da1fff7ab7e99246c3c6fdde6fd2733'/>
<id>f88f24de4da1fff7ab7e99246c3c6fdde6fd2733</id>
<content type='text'>
MALLOC_OPTIONS environment variable, not JEMALLOC_OPTIONS.

Reviewed by:	jasone
Approved by:	emaste (mentor)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MALLOC_OPTIONS environment variable, not JEMALLOC_OPTIONS.

Reviewed by:	jasone
Approved by:	emaste (mentor)
</pre>
</div>
</content>
</entry>
<entry>
<title>mdoc: drop redundant .Pp and .LP calls</title>
<updated>2010-10-08T12:40:16+00:00</updated>
<author>
<name>Ulrich Spörlein</name>
<email>uqs@FreeBSD.org</email>
</author>
<published>2010-10-08T12:40:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0d9deed52c5ed3b24d2da5ec3a0a172fe9092a96'/>
<id>0d9deed52c5ed3b24d2da5ec3a0a172fe9092a96</id>
<content type='text'>
They have no effect when coming in pairs, or before .Bl/.Bd
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They have no effect when coming in pairs, or before .Bl/.Bd
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert changes of 'assure' to 'ensure' made in r211936.</title>
<updated>2010-09-11T10:49:56+00:00</updated>
<author>
<name>Rebecca Cran</name>
<email>brucec@FreeBSD.org</email>
</author>
<published>2010-09-11T10:49:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5512804bb8fe7606fcc50062327c11622c79b6ca'/>
<id>5512804bb8fe7606fcc50062327c11622c79b6ca</id>
<content type='text'>
Approved by: rrs (mentor)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Approved by: rrs (mentor)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix incorrect usage of 'assure' and 'insure'.</title>
<updated>2010-08-28T16:32:01+00:00</updated>
<author>
<name>Rebecca Cran</name>
<email>brucec@FreeBSD.org</email>
</author>
<published>2010-08-28T16:32:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e7f8dd75b3c11bd606a3a4fa82a3bd7834f65421'/>
<id>e7f8dd75b3c11bd606a3a4fa82a3bd7834f65421</id>
<content type='text'>
Approved by: rrs (mentor)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Approved by: rrs (mentor)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix typos and spelling mistakes.</title>
<updated>2010-08-06T14:33:42+00:00</updated>
<author>
<name>Joel Dahl</name>
<email>joel@FreeBSD.org</email>
</author>
<published>2010-08-06T14:33:42+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f6ac23919b16d00845b5e8b3b66662b90b7cb2e6'/>
<id>f6ac23919b16d00845b5e8b3b66662b90b7cb2e6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix bugs:</title>
<updated>2010-01-31T23:16:10+00:00</updated>
<author>
<name>Jason Evans</name>
<email>jasone@FreeBSD.org</email>
</author>
<published>2010-01-31T23:16:10+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d227440524d87c000320b0b8757ac8890714777c'/>
<id>d227440524d87c000320b0b8757ac8890714777c</id>
<content type='text'>
  * Fix a race in chunk_dealloc_dss().

  * Check for allocation failure before zeroing memory in base_calloc().

Merge enhancements from a divergent version of jemalloc:

  * Convert thread-specific caching from magazines to an algorithm that is
    more tunable, and implement incremental GC.

  * Add support for medium size classes, [4KiB..32KiB], 2KiB apart by
    default.

  * Add dirty page tracking for pages within active small/medium object
    runs.  This allows malloc to track precisely which pages are in active
    use, which makes dirty page purging more effective.

  * Base maximum dirty page count on proportion of active memory.

  * Use optional zeroing in arena_chunk_alloc() to avoid needless zeroing
    of chunks.  This is useful in the context of DSS allocation, since a
    long-lived application may commonly recycle chunks.

  * Increase the default chunk size from 1MiB to 4MiB.

Remove feature:

  * Remove the dynamic rebalancing code, since thread caching reduces its
    utility.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  * Fix a race in chunk_dealloc_dss().

  * Check for allocation failure before zeroing memory in base_calloc().

Merge enhancements from a divergent version of jemalloc:

  * Convert thread-specific caching from magazines to an algorithm that is
    more tunable, and implement incremental GC.

  * Add support for medium size classes, [4KiB..32KiB], 2KiB apart by
    default.

  * Add dirty page tracking for pages within active small/medium object
    runs.  This allows malloc to track precisely which pages are in active
    use, which makes dirty page purging more effective.

  * Base maximum dirty page count on proportion of active memory.

  * Use optional zeroing in arena_chunk_alloc() to avoid needless zeroing
    of chunks.  This is useful in the context of DSS allocation, since a
    long-lived application may commonly recycle chunks.

  * Increase the default chunk size from 1MiB to 4MiB.

Remove feature:

  * Remove the dynamic rebalancing code, since thread caching reduces its
    utility.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make malloc(3) superpage aware.  Specifically, if getpagesizes(3) returns</title>
<updated>2009-09-26T18:20:40+00:00</updated>
<author>
<name>Alan Cox</name>
<email>alc@FreeBSD.org</email>
</author>
<published>2009-09-26T18:20:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b8947edcb691809b3be06bf383573d0e7c5cf7c5'/>
<id>b8947edcb691809b3be06bf383573d0e7c5cf7c5</id>
<content type='text'>
a large page size that is greater than malloc(3)'s default chunk size but
less than or equal to 4 MB, then increase the chunk size to match the large
page size.

Most often, using a chunk size that is less than the large page size is not
a problem.  However, consider a long-running application that allocates and
frees significant amounts of memory.  In particular, it frees enough memory
at times that some of that memory is munmap()ed.  Up until the first
munmap(), a 1MB chunk size is just fine; it's not a problem for the virtual
memory system.  Two adjacent 1MB chunks that are aligned on a 2MB boundary
will be promoted automatically to a superpage even though they were
allocated at different times.  The trouble begins with the munmap(),
releasing a 1MB chunk will trigger the demotion of the containing superpage,
leaving behind a half-used 2MB reservation.  Now comes the real problem.
Unfortunately, when the application needs to allocate more memory, and it
recycles the previously munmap()ed address range, the implementation of
mmap() won't be able to reuse the reservation.  Basically, the coalescing
rules in the virtual memory system don't allow this new range to combine
with its neighbor.  The effect being that superpage promotion will not
reoccur for this range of addresses until both 1MB chunks are freed at some
point in the future.

Reviewed by:	jasone
MFC after:	3 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
a large page size that is greater than malloc(3)'s default chunk size but
less than or equal to 4 MB, then increase the chunk size to match the large
page size.

Most often, using a chunk size that is less than the large page size is not
a problem.  However, consider a long-running application that allocates and
frees significant amounts of memory.  In particular, it frees enough memory
at times that some of that memory is munmap()ed.  Up until the first
munmap(), a 1MB chunk size is just fine; it's not a problem for the virtual
memory system.  Two adjacent 1MB chunks that are aligned on a 2MB boundary
will be promoted automatically to a superpage even though they were
allocated at different times.  The trouble begins with the munmap(),
releasing a 1MB chunk will trigger the demotion of the containing superpage,
leaving behind a half-used 2MB reservation.  Now comes the real problem.
Unfortunately, when the application needs to allocate more memory, and it
recycles the previously munmap()ed address range, the implementation of
mmap() won't be able to reuse the reservation.  Basically, the coalescing
rules in the virtual memory system don't allow this new range to combine
with its neighbor.  The effect being that superpage promotion will not
reoccur for this range of addresses until both 1MB chunks are freed at some
point in the future.

Reviewed by:	jasone
MFC after:	3 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert to preferring mmap(2) over sbrk(2) when mapping memory, due to</title>
<updated>2008-11-03T21:17:18+00:00</updated>
<author>
<name>Jason Evans</name>
<email>jasone@FreeBSD.org</email>
</author>
<published>2008-11-03T21:17:18+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b74d3e0c371a55cbd7aba7dc2c9f0001783aa231'/>
<id>b74d3e0c371a55cbd7aba7dc2c9f0001783aa231</id>
<content type='text'>
potential extreme contention in the kernel for multi-threaded applications
on SMP systems.

Reported by:	kris
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
potential extreme contention in the kernel for multi-threaded applications
on SMP systems.

Reported by:	kris
</pre>
</div>
</content>
</entry>
<entry>
<title>Add thread-specific caching for small size classes, based on magazines.</title>
<updated>2008-08-27T02:00:53+00:00</updated>
<author>
<name>Jason Evans</name>
<email>jasone@FreeBSD.org</email>
</author>
<published>2008-08-27T02:00:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d6742bfbd3ecadd2bde38ccbb2351bd5c19ede1d'/>
<id>d6742bfbd3ecadd2bde38ccbb2351bd5c19ede1d</id>
<content type='text'>
This caching allows for completely lock-free allocation/deallocation in the
steady state, at the expense of likely increased memory use and
fragmentation.

Reduce the default number of arenas to 2*ncpus, since thread-specific
caching typically reduces arena contention.

Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced,
cacheline-spaced, and subpage-spaced size classes.  The advantages are:
fewer size classes, reduced false cacheline sharing, and reduced internal
fragmentation for allocations that are slightly over 512, 1024, etc.

Increase RUN_MAX_SMALL, in order to limit fragmentation for the
subpage-spaced size classes.

Add a size--&gt;bin lookup table for small sizes to simplify translating sizes
to size classes.  Include a hard-coded constant table that is used unless
custom size class spacing is specified at run time.

Add the ability to disable tiny size classes at compile time via
MALLOC_TINY.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This caching allows for completely lock-free allocation/deallocation in the
steady state, at the expense of likely increased memory use and
fragmentation.

Reduce the default number of arenas to 2*ncpus, since thread-specific
caching typically reduces arena contention.

Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced,
cacheline-spaced, and subpage-spaced size classes.  The advantages are:
fewer size classes, reduced false cacheline sharing, and reduced internal
fragmentation for allocations that are slightly over 512, 1024, etc.

Increase RUN_MAX_SMALL, in order to limit fragmentation for the
subpage-spaced size classes.

Add a size--&gt;bin lookup table for small sizes to simplify translating sizes
to size classes.  Include a hard-coded constant table that is used unless
custom size class spacing is specified at run time.

Add the ability to disable tiny size classes at compile time via
MALLOC_TINY.
</pre>
</div>
</content>
</entry>
</feed>
