"Markus Amsler" markus.amsler@oribi.org wrote:
void pool_destroy(struct pool* pool) {
- struct pool_arena* arena;
- struct pool_arena* next;
-#ifdef USE_STATS
- unsigned alloc, used, num;
- for (alloc = used = num = 0, arena = pool->first; arena; arena = arena->next)
- {
alloc += pool->arena_size;
used += arena->current - (char*)arena;
num++;
- }
- FIXME("STATS: pool %p has allocated %u kbytes, used %u kbytes in %u arenas,\n"
"\t\t\t\tnon-allocation ratio: %.2f%%\n",
pool, alloc >> 10, used >> 10, num, 100.0 - (float)used / (float)alloc * 100.0);
-#endif
- for (arena = pool->first; arena; arena = next)
- {
next = arena->next;
HeapFree(GetProcessHeap(), 0, arena);
- }
- pool_init(pool, 0);
- return;
}
The old code at least bothered to actually free some memory.