mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Fix assertion in palloc and pvalloc as well.
This commit is contained in:
committed by
Ulrich Drepper
parent
e2f4aa547a
commit
8c0b5f148e
@@ -1,3 +1,9 @@
|
|||||||
|
2010-02-24 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #5553]
|
||||||
|
* malloc/malloc.c (public_vALLOc): Set ar_ptr when trying main_arena.
|
||||||
|
(public_pVALLOc): Likewise.
|
||||||
|
|
||||||
2010-02-22 Jim Meyering <meyering@redhat.com>
|
2010-02-22 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
* manual/math.texi (BSD Random): Fix a typo: s/are/is/
|
* manual/math.texi (BSD Random): Fix a typo: s/are/is/
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Malloc implementation for multiple threads without lock contention.
|
/* Malloc implementation for multiple threads without lock contention.
|
||||||
Copyright (C) 1996-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
Copyright (C) 1996-2009, 2010 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Wolfram Gloger <wg@malloc.de>
|
Contributed by Wolfram Gloger <wg@malloc.de>
|
||||||
and Doug Lea <dl@cs.oswego.edu>, 2001.
|
and Doug Lea <dl@cs.oswego.edu>, 2001.
|
||||||
@@ -3933,9 +3933,10 @@ public_vALLOc(size_t bytes)
|
|||||||
if(!p) {
|
if(!p) {
|
||||||
/* Maybe the failure is due to running out of mmapped areas. */
|
/* Maybe the failure is due to running out of mmapped areas. */
|
||||||
if(ar_ptr != &main_arena) {
|
if(ar_ptr != &main_arena) {
|
||||||
(void)mutex_lock(&main_arena.mutex);
|
ar_ptr = &main_arena;
|
||||||
p = _int_memalign(&main_arena, pagesz, bytes);
|
(void)mutex_lock(&ar_ptr->mutex);
|
||||||
(void)mutex_unlock(&main_arena.mutex);
|
p = _int_memalign(&ar_ptr-> pagesz, bytes);
|
||||||
|
(void)mutex_unlock(&ar_ptr->mutex);
|
||||||
} else {
|
} else {
|
||||||
#if USE_ARENAS
|
#if USE_ARENAS
|
||||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||||
@@ -3978,9 +3979,10 @@ public_pVALLOc(size_t bytes)
|
|||||||
if(!p) {
|
if(!p) {
|
||||||
/* Maybe the failure is due to running out of mmapped areas. */
|
/* Maybe the failure is due to running out of mmapped areas. */
|
||||||
if(ar_ptr != &main_arena) {
|
if(ar_ptr != &main_arena) {
|
||||||
(void)mutex_lock(&main_arena.mutex);
|
ar_ptr = &main_arena;
|
||||||
p = _int_memalign(&main_arena, pagesz, rounded_bytes);
|
(void)mutex_lock(&ar_ptr->mutex);
|
||||||
(void)mutex_unlock(&main_arena.mutex);
|
p = _int_memalign(&ar_ptr-> pagesz, rounded_bytes);
|
||||||
|
(void)mutex_unlock(&ar_ptr->mutex);
|
||||||
} else {
|
} else {
|
||||||
#if USE_ARENAS
|
#if USE_ARENAS
|
||||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||||
|
Reference in New Issue
Block a user