malloc() now also logs an error when a request could not be served.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27677 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-09-21 21:25:58 +00:00
parent 4ed420362a
commit cc3b6f3a05
+4 -1
View File
@@ -252,8 +252,10 @@ malloc(size_t size)
// align the size requirement to a 4 bytes boundary // align the size requirement to a 4 bytes boundary
size = (size + 3) & 0xfffffffc; size = (size + 3) & 0xfffffffc;
if (size > sAvailable) if (size > sAvailable) {
dprintf("malloc(): Out of memory!\n");
return NULL; return NULL;
}
free_chunk *chunk = sFreeAnchor.next, *last = &sFreeAnchor; free_chunk *chunk = sFreeAnchor.next, *last = &sFreeAnchor;
while (chunk && chunk->Size() < size) { while (chunk && chunk->Size() < size) {
@@ -263,6 +265,7 @@ malloc(size_t size)
if (chunk == NULL) { if (chunk == NULL) {
// could not find a free chunk as large as needed // could not find a free chunk as large as needed
dprintf("malloc(): Out of memory!\n");
return NULL; return NULL;
} }