dbghelp: Improved arena allocation in pool_alloc.
This commit is contained in:
parent
1690044d78
commit
4e1a4ecc04
|
@ -108,13 +108,13 @@ void* pool_alloc(struct pool* pool, size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = max( pool->arena_size, len + sizeof(struct pool_arena) );
|
size = max( pool->arena_size, len );
|
||||||
arena = HeapAlloc(GetProcessHeap(), 0, size);
|
arena = HeapAlloc(GetProcessHeap(), 0, size + sizeof(struct pool_arena));
|
||||||
if (!arena) return NULL;
|
if (!arena) return NULL;
|
||||||
|
|
||||||
ret = arena + 1;
|
ret = arena + 1;
|
||||||
arena->current = (char*)ret + len;
|
arena->current = (char*)ret + len;
|
||||||
arena->end = (char *)arena + size;
|
arena->end = (char*)ret + size;
|
||||||
if (arena->current + 16 >= arena->end)
|
if (arena->current + 16 >= arena->end)
|
||||||
list_add_tail( &pool->arena_full, &arena->entry );
|
list_add_tail( &pool->arena_full, &arena->entry );
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue