server-skynet-source-3rd-je.../include/jemalloc/internal
Daniel Micay 879e76a9e5 teach the dss chunk allocator to handle new_addr
This provides in-place expansion of huge allocations when the end of the
allocation is at the end of the sbrk heap. There's already the ability
to extend in-place via recycled chunks but this handles the initial
growth of the heap via repeated vector / string reallocations.

A possible future extension could allow realloc to go from the following:

    | huge allocation | recycled chunks |
                                        ^ dss_end

To a larger allocation built from recycled *and* new chunks:

    |                      huge allocation                      |
                                                                ^ dss_end

Doing that would involve teaching the chunk recycling code to request
new chunks to satisfy the request. The chunk_dss code wouldn't require
any further changes.

    #include <stdlib.h>

    int main(void) {
        size_t chunk = 4 * 1024 * 1024;
        void *ptr = NULL;
        for (size_t size = chunk; size < chunk * 128; size *= 2) {
            ptr = realloc(ptr, size);
            if (!ptr) return 1;
        }
    }

dss:secondary: 0.083s
dss:primary: 0.083s

After:

dss:secondary: 0.083s
dss:primary: 0.003s

The dss heap grows in the upwards direction, so the oldest chunks are at
the low addresses and they are used first. Linux prefers to grow the
mmap heap downwards, so the trick will not work in the *current* mmap
chunk allocator as a huge allocation will only be at the top of the heap
in a contrived case.
2014-11-28 16:11:19 -08:00
..
arena.h Fix arena_sdalloc() to use promoted size (second attempt). 2014-10-31 22:26:24 -07:00
atomic.h Add atomic operations tests and fix latent bugs. 2014-08-06 23:36:19 -07:00
base.h Refactor huge allocation to be managed by arenas. 2014-05-15 22:36:41 -07:00
bitmap.h Convert to uniform style: cond == false --> !cond 2014-10-03 10:16:09 -07:00
chunk_dss.h teach the dss chunk allocator to handle new_addr 2014-11-28 16:11:19 -08:00
chunk_mmap.h Refactor huge allocation to be managed by arenas. 2014-05-15 22:36:41 -07:00
chunk.h Normalize size classes. 2014-10-06 01:45:13 -07:00
ckh.h Convert all tsd variables to reside in a single tsd structure. 2014-09-23 02:36:08 -07:00
ctl.h Add per size class huge allocation statistics. 2014-10-12 23:02:10 -07:00
extent.h Implement per thread heap profiling. 2014-08-19 21:31:16 -07:00
hash.h Use KQU() rather than QU() where applicable. 2014-05-28 21:17:42 -07:00
huge.h Add configure options. 2014-10-09 22:44:37 -07:00
jemalloc_internal_decls.h Try to use __builtin_ffsl if ffsl is unavailable. 2014-06-02 07:44:50 -07:00
jemalloc_internal_defs.h.in Add --with-lg-tiny-min, generalize --with-lg-quantum. 2014-10-10 22:35:07 -07:00
jemalloc_internal_macros.h Use KQU() rather than QU() where applicable. 2014-05-28 21:17:42 -07:00
jemalloc_internal.h.in avoid redundant chunk header reads 2014-10-30 17:06:38 -07:00
mb.h Simplify small size class infrastructure. 2012-02-28 16:50:47 -08:00
mutex.h correctly detect adaptive mutexes in pthreads 2014-09-29 16:10:40 -07:00
private_namespace.sh Refactor to support more varied testing. 2013-12-03 22:06:59 -08:00
private_symbols.txt Make quarantine_init() static. 2014-11-07 14:50:38 -08:00
private_unnamespace.sh Refactor to support more varied testing. 2013-12-03 22:06:59 -08:00
prng.h Whitespace cleanups. 2014-09-04 22:27:26 -07:00
prof.h Miscellaneous cleanups. 2014-10-30 23:18:45 -07:00
public_namespace.sh Fix name mangling for stress tests. 2014-01-16 17:38:01 -08:00
public_unnamespace.sh Fix name mangling for stress tests. 2014-01-16 17:38:01 -08:00
ql.h Normalize #define whitespace. 2013-12-08 22:28:27 -08:00
qr.h Normalize #define whitespace. 2013-12-08 22:28:27 -08:00
quarantine.h Make quarantine_init() static. 2014-11-07 14:50:38 -08:00
rb.h Convert to uniform style: cond == false --> !cond 2014-10-03 10:16:09 -07:00
rtree.h Convert rtree from (void *) to (uint8_t) storage. 2014-01-02 17:36:38 -08:00
size_classes.sh Add --with-lg-tiny-min, generalize --with-lg-quantum. 2014-10-10 22:35:07 -07:00
stats.h Add per size class huge allocation statistics. 2014-10-12 23:02:10 -07:00
tcache.h Add configure options. 2014-10-09 22:44:37 -07:00
tsd.h Remove extra definition of je_tsd_boot on win32. 2014-11-18 19:08:18 -02:00
util.h Use MSVC intrinsics for lg_floor 2014-09-24 11:55:02 +01:00
valgrind.h mark some conditions as unlikely 2014-09-10 21:49:42 -04:00