From c3f84a1df542f9accc1ed208c940f2b59cdd0680 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 23 Jan 2010 16:06:19 +0000 Subject: [PATCH] _FreeChunk(): When freeing a chunk from a formerly full meta chunk, we have to add it back to its partial list or it would be leaked. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35266 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/slab/MemoryManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/system/kernel/slab/MemoryManager.cpp b/src/system/kernel/slab/MemoryManager.cpp index e0f83b8703..a7251ecb60 100644 --- a/src/system/kernel/slab/MemoryManager.cpp +++ b/src/system/kernel/slab/MemoryManager.cpp @@ -443,6 +443,13 @@ MemoryManager::_FreeChunk(Area* area, MetaChunk* metaChunk, Chunk* chunk, ASSERT(area->usedMetaChunkCount > 0); if (--area->usedMetaChunkCount == 0) _FreeArea(area, false, flags); + } else if (metaChunk->usedChunkCount == metaChunk->chunkCount - 1) { + // the meta chunk was full before -- add it back to its partial chunk + // list + if (metaChunk->chunkSize == SLAB_CHUNK_SIZE_SMALL) + sPartialMetaChunksSmall.Add(metaChunk, false); + else if (metaChunk->chunkSize == SLAB_CHUNK_SIZE_MEDIUM) + sPartialMetaChunksMedium.Add(metaChunk, false); } }