From ac5af8f1b404610789b6d49fe2d877b3d39fde72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 30 May 2005 14:10:06 +0000 Subject: [PATCH] The maximum allocation size we've configured our allocator is 1 GB. Instead of running into an assert() later on, we now back out early in this case. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12902 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/malloc/threadheap.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/malloc/threadheap.cpp b/src/system/libroot/posix/malloc/threadheap.cpp index 3e1bb901de..5d273c0f8f 100644 --- a/src/system/libroot/posix/malloc/threadheap.cpp +++ b/src/system/libroot/posix/malloc/threadheap.cpp @@ -44,6 +44,13 @@ threadHeap::threadHeap(void) void * threadHeap::malloc(const size_t size) { +#if MAX_INTERNAL_FRAGMENTATION == 2 + if (size > 1063315264UL) { + debug_printf("malloc() of %lu bytes asked\n", size); + return NULL; + } +#endif + const int sizeclass = sizeClass(size); block *b = NULL; @@ -54,7 +61,6 @@ threadHeap::malloc(const size_t size) // superblock list. superblock *sb = findAvailableSuperblock(sizeclass, b, _pHeap); - if (sb == NULL) { // We don't have memory locally. // Try to get more from the process heap.