Implementing object model, memory allocators finalization routines. Adding assertion that all memory was freed before exit.

This commit is contained in:
Ruben Ayrapetyan
2014-08-07 19:24:32 +04:00
parent 5e1c4b533f
commit 99c15ef802
16 changed files with 140 additions and 20 deletions
+20
View File
@@ -122,6 +122,26 @@ mem_pools_init(void)
mem_pools_stat_init();
} /* mem_pools_init */
/**
* Finalize pool manager
*/
void
mem_pools_finalize(void)
{
for ( uint32_t i = 0; i < MEM_POOL_CHUNK_TYPE__COUNT; i++ )
{
JERRY_ASSERT( mem_pools[ i ] == NULL );
JERRY_ASSERT( mem_free_chunks_number[ i ] == 0 );
}
JERRY_ASSERT( mem_pool_for_pool_headers.chunks_number == mem_pool_for_pool_headers.free_chunks_number );
__memset( &mem_pool_for_pool_headers, 0, sizeof(mem_pool_for_pool_headers));
mem_heap_free_block( mem_space_for_pool_for_pool_headers);
mem_space_for_pool_for_pool_headers = NULL;
} /* mem_pools_finalize */
/**
* Allocate a chunk of specified size
*