Skip to content

Commit fa755e3

Browse files
committed
Change pool-based allocation to heap-based allocation in jerry.c
There was an abuse of memory pools in jerry.c: `compiled_code_map_entry_t` is not an ECMA data model object but was still alocated/freed via mem pool functions. Changed the appropriate calls to heap-related functions. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent c0f3a9f commit fa755e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jerry-core/jerry.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,8 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
18481848

18491849
snapshot_last_compiled_code_offset = snapshot_buffer_write_offset;
18501850

1851-
compiled_code_map_entry_t *new_entry = (compiled_code_map_entry_t *) mem_pools_alloc ();
1851+
compiled_code_map_entry_t *new_entry =
1852+
(compiled_code_map_entry_t *) mem_heap_alloc_block (sizeof (compiled_code_map_entry_t));
18521853

18531854
if (new_entry == NULL)
18541855
{
@@ -2122,7 +2123,7 @@ jerry_parse_and_save_snapshot (const jerry_api_char_t *source_p, /**< script sou
21222123
{
21232124
compiled_code_map_entry_t *next_p = ECMA_GET_POINTER (compiled_code_map_entry_t,
21242125
current_p->next_cp);
2125-
mem_pools_free ((uint8_t *) current_p);
2126+
mem_heap_free_block (current_p, sizeof (compiled_code_map_entry_t));
21262127
current_p = next_p;
21272128
}
21282129

0 commit comments

Comments
 (0)