From 23e03697201b7ccbb1b2b993f4945ebe8df17489 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 18 May 2020 07:16:11 +0200 Subject: [PATCH] DOC: write_heap_snapshot (#164) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 7248112..cd41ae5 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,16 @@ context.eval("a = 2") # nothing works on the context from now on, its a shell waiting to be disposed ``` +A MiniRacer context can also be dumped in a heapsnapshot file using `#write_heap_snapshot(file_or_io)` + +```ruby +context = MiniRacer::Context.new(timeout: 5) +context.eval("let a='testing';") +context.write_heap_snapshot("test.heapsnapshot") +``` + +This file can then be loaded in the memory tab of the chrome dev console. + ### Function call This calls the function passed as first argument: