Deleted Added
sdiff udiff text old ( 286866 ) new ( 288090 )
full compact
1#define JEMALLOC_CHUNK_DSS_C_
2#include "jemalloc/internal/jemalloc_internal.h"
3/******************************************************************************/
4/* Data. */
5
6const char *dss_prec_names[] = {
7 "disabled",
8 "primary",

--- 55 unchanged lines hidden (view full) ---

64 malloc_mutex_unlock(&dss_mtx);
65 return (false);
66}
67
68void *
69chunk_alloc_dss(arena_t *arena, void *new_addr, size_t size, size_t alignment,
70 bool *zero, bool *commit)
71{
72 cassert(have_dss);
73 assert(size > 0 && (size & chunksize_mask) == 0);
74 assert(alignment > 0 && (alignment & chunksize_mask) == 0);
75
76 /*
77 * sbrk() uses a signed increment argument, so take care not to
78 * interpret a huge allocation request as a negative increment.
79 */
80 if ((intptr_t)size < 0)
81 return (NULL);
82
83 malloc_mutex_lock(&dss_mtx);
84 if (dss_prev != (void *)-1) {
85
86 /*
87 * The loop is necessary to recover from races with other
88 * threads that are using the DSS for something other than
89 * malloc.
90 */
91 do {
92 void *ret, *cpad, *dss_next;
93 size_t gap_size, cpad_size;
94 intptr_t incr;
95 /* Avoid an unnecessary system call. */
96 if (new_addr != NULL && dss_max != new_addr)
97 break;
98
99 /* Get the current end of the DSS. */
100 dss_max = chunk_dss_sbrk(0);
101
102 /* Make sure the earlier condition still holds. */

--- 112 unchanged lines hidden ---