mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:07:44 +00:00
LibJS: Only consider VM-accessible execution contexts as strong roots
Partially reverts 3dc5f467a8
to fix
GC memory leak that happens because we treated all execution contexts
as strong roots.
This commit is contained in:
parent
cbb660c756
commit
b108d51c5b
9 changed files with 32 additions and 18 deletions
|
@ -450,9 +450,6 @@ void Heap::mark_live_cells(HashMap<Cell*, HeapRoot> const& roots)
|
|||
|
||||
MarkingVisitor visitor(*this, roots);
|
||||
|
||||
for (auto& execution_context : m_execution_contexts)
|
||||
execution_context.visit_edges(visitor);
|
||||
|
||||
vm().bytecode_interpreter().visit_edges(visitor);
|
||||
|
||||
visitor.mark_all_live_cells();
|
||||
|
|
|
@ -148,7 +148,6 @@ private:
|
|||
HandleImpl::List m_handles;
|
||||
MarkedVectorBase::List m_marked_vectors;
|
||||
WeakContainer::List m_weak_containers;
|
||||
ExecutionContext::List m_execution_contexts;
|
||||
|
||||
Vector<GCPtr<Cell>> m_uprooted_cells;
|
||||
|
||||
|
@ -196,16 +195,4 @@ inline void Heap::did_destroy_weak_container(Badge<WeakContainer>, WeakContainer
|
|||
m_weak_containers.remove(set);
|
||||
}
|
||||
|
||||
inline void Heap::did_create_execution_context(Badge<ExecutionContext>, ExecutionContext& set)
|
||||
{
|
||||
VERIFY(!m_execution_contexts.contains(set));
|
||||
m_execution_contexts.append(set);
|
||||
}
|
||||
|
||||
inline void Heap::did_destroy_execution_context(Badge<ExecutionContext>, ExecutionContext& set)
|
||||
{
|
||||
VERIFY(m_execution_contexts.contains(set));
|
||||
m_execution_contexts.remove(set);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue