about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-27 15:23:47 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-27 15:23:47 +0100
commitbd12a8be71fb6774da0f68141cf07f33e5145c86 (patch)
tree4b3980cab9bca1b2939df89929e1cc98037099e5 /src/display/client.nim
parent9bc2977412ebc1e1cec67a1aa0449c8cca8e36a9 (diff)
downloadchawan-bd12a8be71fb6774da0f68141cf07f33e5145c86.tar.gz
dom: fix collection caching
Use ids instead of pure pointers, so we can utilize the JS finalizer.
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 2e6528a3..928fd32d 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -446,6 +446,12 @@ proc nimGCStats(client: Client): string {.jsfunc.} =
 proc jsGCStats(client: Client): string {.jsfunc.} =
   return client.jsrt.getMemoryUsage()
 
+proc nimCollect(client: Client) {.jsfunc.} =
+  GC_fullCollect()
+
+proc jsCollect(client: Client) {.jsfunc.} =
+  JS_RunGC(client.jsrt)
+
 proc show(console: Console) {.jsfunc.} =
   if console.pager.container != console.container:
     console.prev = console.pager.container