mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS: Add API for doing GC with a little debug log report at end
You can now pass print_report=true to Heap::collect_garbage() and it will print out a little summary of the time spent, and counts of live vs freed cells and blocks.
This commit is contained in:
parent
6444f49d22
commit
bbd3192535
2 changed files with 31 additions and 5 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Runtime/Cell.h>
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
CollectEverything,
|
||||
};
|
||||
|
||||
void collect_garbage(CollectionType = CollectionType::CollectGarbage);
|
||||
void collect_garbage(CollectionType = CollectionType::CollectGarbage, bool print_report = false);
|
||||
|
||||
Interpreter& interpreter() { return m_interpreter; }
|
||||
|
||||
|
@ -90,7 +91,7 @@ private:
|
|||
void gather_roots(HashTable<Cell*>&);
|
||||
void gather_conservative_roots(HashTable<Cell*>&);
|
||||
void mark_live_cells(const HashTable<Cell*>& live_cells);
|
||||
void sweep_dead_cells();
|
||||
void sweep_dead_cells(bool print_report, const Core::ElapsedTimer&);
|
||||
|
||||
Cell* cell_from_possible_pointer(FlatPtr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue