Closed guyio closed 6 years ago
If you are hosting ChakraCore yourself, then there is a JsCollectGarbage
native method which you can call to trigger a garbage collection. You can construct a javascript wrapper function around that and expose it on the global object if you want.
I'll add a bit more info, sorry.
I'm fuzzing the js engine via the ch.exe binary. my inputs are using the gc() function from js.
I'd like to do the minimal required changes to let the ch.exe expose the GC from js.
For example, in JavaScriptCore, V8 and SpiderMonkey it's supported with runtime flags or compilation flags.
If it's not supported in Chakra's builtin example - 'ch.exe', could you please point me to an example that adds a native function? i'll take off from there.
Thanks for your help!
Ah, I see. If you are using a debug or test ch.exe binary, then if you pass it the -collectgarbage
command line argument, then it will expose a global CollectGarbage()
function which triggers a garbage collection.
Thank you! It's exactly what I needed.
Hey, is there an easy way to expose GC from withing a script in ch? I'd like to run a js script that contains a statement - 'gc();' and that this statement will run a GC cycle.