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 316081 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]
proposed patch to fix valloc() to fall back to arena.
valloc-use-arenas.patch (text/plain), 1.98 KB, created by
Flavio Leitner
on 2008-09-08 13:51:20 UTC
(
hide
)
Description:
proposed patch to fix valloc() to fall back to arena.
Filename:
MIME Type:
Creator:
Flavio Leitner
Created:
2008-09-08 13:51:20 UTC
Size:
1.98 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> > > >--- glibc-2.5-20061008T1257/malloc/malloc.c.orig 2008-09-08 08:31:05.000000000 -0400 >+++ glibc-2.5-20061008T1257/malloc/malloc.c 2008-09-08 08:33:47.000000000 -0400 >@@ -3773,6 +3773,25 @@ public_vALLOc(size_t bytes) > 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, mp_.pagesize, 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, mp_.pagesize, bytes); >+ (void)mutex_unlock(&ar_ptr->mutex); >+ } >+#endif >+ } >+ } >+ assert(!p || chunk_is_mmapped(mem2chunk(p)) || >+ ar_ptr == arena_for_chunk(mem2chunk(p))); > return p; > } > >@@ -3796,6 +3815,25 @@ public_pVALLOc(size_t bytes) > arena_get(ar_ptr, bytes + 2*mp_.pagesize + 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, mp_.pagesize, 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, mp_.pagesize, 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