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

--- 112 unchanged lines hidden ---