mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
WebContent: Try to run manual GC with less stuff on the stack
This makes it more likely to succeed in collecting stuff that's actually dead, by reducing the memory range scanned for possible pointers.
This commit is contained in:
parent
08ae305dc5
commit
1510c1876c
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
|
|
@ -354,7 +355,10 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString const& request,
|
|||
}
|
||||
|
||||
if (request == "collect-garbage") {
|
||||
Web::Bindings::main_thread_vm().heap().collect_garbage(JS::Heap::CollectionType::CollectGarbage, true);
|
||||
// NOTE: We use deferred_invoke here to ensure that GC runs with as little on the stack as possible.
|
||||
Core::deferred_invoke([] {
|
||||
Web::Bindings::main_thread_vm().heap().collect_garbage(JS::Heap::CollectionType::CollectGarbage, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user