Skip to content

Question: How to remove dynamic function snapshot completely? #2749

Open
@bryanle92

Description

@bryanle92

I found a memory leak when loading and releasing dynamic function snapshot. My code looks like that:

jerry_value_t return_value;

return_value = jerry_load_function_snapshot(snapshot, snapshot_size, 0, JERRY_SNAPSHOT_EXEC_ALLOW_STATIC);
// The current allocated heap increase 3984 bytes

jerry_release_value(return_value);
jerry_gc(JERRY_GC_SEVERITY_HIGH);
// The current allocated heap decrease 2224 bytes

return_value = jerry_load_function_snapshot(snapshot, snapshot_size, 0, JERRY_SNAPSHOT_EXEC_ALLOW_STATIC);
// The current allocated heap increase 2112 bytes

jerry_release_value(return_value);
jerry_gc(JERRY_GC_SEVERITY_HIGH);
// The current allocated heap decrease 2224 bytes

The issue was not happened if I use static snapshot instead of dynamic snapshot (the heap always increases and decreases by exactly 24 bytes). I just want to know where does this leak come from, and is there anyway to remove a loaded dynamic snapshot completely?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions