Introducing 'try to give memory back' callback for heap allocator to use upon allocation request that can not be satisfied by the allocator.

This commit is contained in:
Ruben Ayrapetyan
2014-12-18 21:20:28 +03:00
parent 8febd2bae8
commit 6bb39bb8ea
14 changed files with 308 additions and 105 deletions
+8 -1
View File
@@ -15,8 +15,10 @@
#include "ecma-builtins.h"
#include "ecma-helpers.h"
#include "ecma-gc.h"
#include "ecma-lcache.h"
#include "ecma-operations.h"
#include "mem-allocator.h"
/** \addtogroup ecma ECMA
* @{
@@ -34,6 +36,8 @@ ecma_init (void)
ecma_strings_init ();
ecma_init_builtins ();
ecma_lcache_init ();
mem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
} /* ecma_init */
/**
@@ -42,8 +46,11 @@ ecma_init (void)
void
ecma_finalize (void)
{
ecma_lcache_invalidate_all ();
mem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
ecma_finalize_builtins ();
ecma_lcache_invalidate_all ();
ecma_gc_run (ECMA_GC_GEN_COUNT - 1);
} /* ecma_finalize */
/**