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 316566 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]
patch fixing valloc/pvalloc to fall back to arenas
valloc-use-arenas.patch (text/plain), 3.13 KB, created by
Flavio Leitner
on 2008-09-12 12:37:40 UTC
(
hide
)
Description:
patch fixing valloc/pvalloc to fall back to arenas
Filename:
MIME Type:
Creator:
Flavio Leitner
Created:
2008-09-12 12:37:40 UTC
Size:
3.13 KB
patch
obsolete
> >This patch fixes glibc valloc() and pvalloc() to fall back to >arenas in case of failure. > >signed-of-by: Flavio Leitner <fleitner@redhat.com> > > >Index: glibc-2.5-20061008T1257/malloc/malloc.c >=================================================================== >--- glibc-2.5-20061008T1257.orig/malloc/malloc.c >+++ glibc-2.5-20061008T1257/malloc/malloc.c >@@ -3758,7 +3758,9 @@ public_vALLOc(size_t bytes) > { > mstate ar_ptr; > Void_t *p; >+ size_t pagesz; > >+ pagesz = mp_.pagesize; > if(__malloc_initialized < 0) > ptmalloc_init (); > >@@ -3766,13 +3768,32 @@ public_vALLOc(size_t bytes) > __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; > } > >@@ -3781,7 +3802,11 @@ public_pVALLOc(size_t bytes) > { > mstate ar_ptr; > Void_t *p; >+ size_t pagesz; >+ size_t page_mask; > >+ pagesz = mp_.pagesize; >+ page_mask = mp_.pagesize - 1; > if(__malloc_initialized < 0) > ptmalloc_init (); > >@@ -3789,13 +3814,34 @@ public_pVALLOc(size_t bytes) > __const __malloc_ptr_t)) = > __memalign_hook; > if (hook != NULL) >- return (*hook)(mp_.pagesize, >- (bytes + mp_.pagesize - 1) & ~(mp_.pagesize - 1), >+ return (*hook)(pagesz, (bytes + page_mask) & ~(page_mask), > 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, >+ (bytes + page_mask) & ~(page_mask)); >+ (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 + page_mask) & ~(page_mask)); >+ if(ar_ptr) { >+ p = _int_memalign(ar_ptr, pagesz, >+ (bytes + page_mask) & ~(page_mask)); >+ (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