diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-16 19:18:46 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-16 19:18:46 +0100 |
commit | cb2e7d1c5f702cd80171ace1b201f382aa69f9d5 (patch) | |
tree | fcc493db644c2c045667087ec5816de84fb44626 /Libraries/LibJS/Heap/Heap.cpp | |
parent | ab404a2f8861a30ccc8e200ca06399b23add453c (diff) | |
download | serenity-cb2e7d1c5f702cd80171ace1b201f382aa69f9d5.zip |
LibJS+js: Add a debug option (js -g) to GC after every allocation
This is very useful for discovering collector bugs.
Diffstat (limited to 'Libraries/LibJS/Heap/Heap.cpp')
-rw-r--r-- | Libraries/LibJS/Heap/Heap.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Libraries/LibJS/Heap/Heap.cpp b/Libraries/LibJS/Heap/Heap.cpp index 31707a1150..f8ee6794c7 100644 --- a/Libraries/LibJS/Heap/Heap.cpp +++ b/Libraries/LibJS/Heap/Heap.cpp @@ -49,6 +49,9 @@ Heap::~Heap() Cell* Heap::allocate_cell(size_t size) { + if (should_collect_on_every_allocation()) + collect_garbage(); + for (auto& block : m_blocks) { if (size > block->cell_size()) continue; |