mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
malloc: Remove arena_mem variable
The computed value is never used. The accesses were data races.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2016-02-19 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
* malloc/malloc.c (sysmalloc): Do not update arena_max.
|
||||||
|
* malloc/arena.c (arena_max): Remove.
|
||||||
|
(heap_trim, _int_new_arena): Do not update arena_max.
|
||||||
|
|
||||||
2016-02-19 Florian Weimer <fweimer@redhat.com>
|
2016-02-19 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
* resolv/res_init.c (res_ninit): Update comment.
|
* resolv/res_init.c (res_ninit): Update comment.
|
||||||
|
@ -91,9 +91,6 @@ static mstate free_list;
|
|||||||
acquired. */
|
acquired. */
|
||||||
static mutex_t list_lock = _LIBC_LOCK_INITIALIZER;
|
static mutex_t list_lock = _LIBC_LOCK_INITIALIZER;
|
||||||
|
|
||||||
/* Mapped memory in non-main arenas (reliable only for NO_THREADS). */
|
|
||||||
static unsigned long arena_mem;
|
|
||||||
|
|
||||||
/* Already initialized? */
|
/* Already initialized? */
|
||||||
int __malloc_initialized = -1;
|
int __malloc_initialized = -1;
|
||||||
|
|
||||||
@ -705,7 +702,6 @@ heap_trim (heap_info *heap, size_t pad)
|
|||||||
if (new_size + (HEAP_MAX_SIZE - prev_heap->size) < pad + MINSIZE + pagesz)
|
if (new_size + (HEAP_MAX_SIZE - prev_heap->size) < pad + MINSIZE + pagesz)
|
||||||
break;
|
break;
|
||||||
ar_ptr->system_mem -= heap->size;
|
ar_ptr->system_mem -= heap->size;
|
||||||
arena_mem -= heap->size;
|
|
||||||
LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
|
LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
|
||||||
delete_heap (heap);
|
delete_heap (heap);
|
||||||
heap = prev_heap;
|
heap = prev_heap;
|
||||||
@ -743,7 +739,6 @@ heap_trim (heap_info *heap, size_t pad)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ar_ptr->system_mem -= extra;
|
ar_ptr->system_mem -= extra;
|
||||||
arena_mem -= extra;
|
|
||||||
|
|
||||||
/* Success. Adjust top accordingly. */
|
/* Success. Adjust top accordingly. */
|
||||||
set_head (top_chunk, (top_size - extra) | PREV_INUSE);
|
set_head (top_chunk, (top_size - extra) | PREV_INUSE);
|
||||||
@ -793,7 +788,6 @@ _int_new_arena (size_t size)
|
|||||||
a->attached_threads = 1;
|
a->attached_threads = 1;
|
||||||
/*a->next = NULL;*/
|
/*a->next = NULL;*/
|
||||||
a->system_mem = a->max_system_mem = h->size;
|
a->system_mem = a->max_system_mem = h->size;
|
||||||
arena_mem += h->size;
|
|
||||||
|
|
||||||
/* Set up the top chunk, with proper alignment. */
|
/* Set up the top chunk, with proper alignment. */
|
||||||
ptr = (char *) (a + 1);
|
ptr = (char *) (a + 1);
|
||||||
|
@ -2410,7 +2410,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
|
|||||||
&& grow_heap (old_heap, MINSIZE + nb - old_size) == 0)
|
&& grow_heap (old_heap, MINSIZE + nb - old_size) == 0)
|
||||||
{
|
{
|
||||||
av->system_mem += old_heap->size - old_heap_size;
|
av->system_mem += old_heap->size - old_heap_size;
|
||||||
arena_mem += old_heap->size - old_heap_size;
|
|
||||||
set_head (old_top, (((char *) old_heap + old_heap->size) - (char *) old_top)
|
set_head (old_top, (((char *) old_heap + old_heap->size) - (char *) old_top)
|
||||||
| PREV_INUSE);
|
| PREV_INUSE);
|
||||||
}
|
}
|
||||||
@ -2420,7 +2419,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
|
|||||||
heap->ar_ptr = av;
|
heap->ar_ptr = av;
|
||||||
heap->prev = old_heap;
|
heap->prev = old_heap;
|
||||||
av->system_mem += heap->size;
|
av->system_mem += heap->size;
|
||||||
arena_mem += heap->size;
|
|
||||||
/* Set up the new top. */
|
/* Set up the new top. */
|
||||||
top (av) = chunk_at_offset (heap, sizeof (*heap));
|
top (av) = chunk_at_offset (heap, sizeof (*heap));
|
||||||
set_head (top (av), (heap->size - sizeof (*heap)) | PREV_INUSE);
|
set_head (top (av), (heap->size - sizeof (*heap)) | PREV_INUSE);
|
||||||
|
Reference in New Issue
Block a user