Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 316613 Details for
Bug 461481
[5.2] valloc() fails with ENOMEM without trying to use arenas
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
backport for 2.5-25
rh-2_5-25-valloc.patch (text/plain), 3.11 KB, created by
Flavio Leitner
on 2008-09-12 19:33:52 UTC
(
hide
)
Description:
backport for 2.5-25
Filename:
MIME Type:
Creator:
Flavio Leitner
Created:
2008-09-12 19:33:52 UTC
Size:
3.11 KB
patch
obsolete
>2008-09-12 Flavio Leitner <fleitner@redhat.com> > Ulrich Drepper <drepper@redhat.com> > > * malloc/malloc.c (public_vALLOc): Try other arenas in case > _int_valloc fails. > (public_pVALLOc): Likewise. > >Index: glibc-2.5-20061008T1257/malloc/malloc.c >=================================================================== >--- glibc-2.5-20061008T1257.orig/malloc/malloc.c >+++ glibc-2.5-20061008T1257/malloc/malloc.c >@@ -3762,17 +3762,39 @@ public_vALLOc(size_t bytes) > if(__malloc_initialized < 0) > ptmalloc_init (); > >+ size_t pagesz = mp_.pagesize; >+ > __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, > __const __malloc_ptr_t)) = > __memalign_hook; > if (hook != NULL) >- return (*hook)(mp_.pagesize, bytes, RETURN_ADDRESS (0)); >+ return (*hook)(pagesz, bytes, RETURN_ADDRESS (0)); > >- arena_get(ar_ptr, bytes + mp_.pagesize + MINSIZE); >+ arena_get(ar_ptr, bytes + pagesz + MINSIZE); > if(!ar_ptr) > return 0; > p = _int_valloc(ar_ptr, bytes); > (void)mutex_unlock(&ar_ptr->mutex); >+ if(!p) { >+ /* Maybe the failure is due to running out of mmapped areas. */ >+ if(ar_ptr != &main_arena) { >+ (void)mutex_lock(&main_arena.mutex); >+ p = _int_memalign(&main_arena, pagesz, bytes); >+ (void)mutex_unlock(&main_arena.mutex); >+ } else { >+#if USE_ARENAS >+ /* ... or sbrk() has failed and there is still a chance to mmap() */ >+ ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes); >+ if(ar_ptr) { >+ p = _int_memalign(ar_ptr, pagesz, bytes); >+ (void)mutex_unlock(&ar_ptr->mutex); >+ } >+#endif >+ } >+ } >+ assert(!p || chunk_is_mmapped(mem2chunk(p)) || >+ ar_ptr == arena_for_chunk(mem2chunk(p))); >+ > return p; > } > >@@ -3785,17 +3807,40 @@ public_pVALLOc(size_t bytes) > if(__malloc_initialized < 0) > ptmalloc_init (); > >+ size_t pagesz = mp_.pagesize; >+ size_t page_mask = mp_.pagesize - 1; >+ size_t rounded_bytes = (bytes + page_mask) & ~(page_mask); >+ > __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, > __const __malloc_ptr_t)) = > __memalign_hook; > if (hook != NULL) >- return (*hook)(mp_.pagesize, >- (bytes + mp_.pagesize - 1) & ~(mp_.pagesize - 1), >- RETURN_ADDRESS (0)); >+ return (*hook)(pagesz, rounded_bytes, RETURN_ADDRESS (0)); > >- arena_get(ar_ptr, bytes + 2*mp_.pagesize + MINSIZE); >+ arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE); > p = _int_pvalloc(ar_ptr, bytes); > (void)mutex_unlock(&ar_ptr->mutex); >+ if(!p) { >+ /* Maybe the failure is due to running out of mmapped areas. */ >+ if(ar_ptr != &main_arena) { >+ (void)mutex_lock(&main_arena.mutex); >+ p = _int_memalign(&main_arena, pagesz, rounded_bytes); >+ (void)mutex_unlock(&main_arena.mutex); >+ } else { >+#if USE_ARENAS >+ /* ... or sbrk() has failed and there is still a chance to mmap() */ >+ ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, >+ bytes + 2*pagesz + MINSIZE); >+ if(ar_ptr) { >+ p = _int_memalign(ar_ptr, pagesz, rounded_bytes); >+ (void)mutex_unlock(&ar_ptr->mutex); >+ } >+#endif >+ } >+ } >+ assert(!p || chunk_is_mmapped(mem2chunk(p)) || >+ ar_ptr == arena_for_chunk(mem2chunk(p))); >+ > return p; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 461481
:
316081
|
316566
| 316613 |
316623