mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00: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
Notes:
github-actions[bot]
2024-11-10 18:14:16 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/1510c1876c0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2268
1 changed files with 5 additions and 1 deletions
|
@ -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 a new issue