GNOME Bugzilla – Bug 593215
imports.spidermonkey
Last modified: 2009-09-16 00:26:24 UTC
For various debugging/developer purposes it'd be nice to have a "spidermonkey" module which exposes some internals. In particular I can think of: * Spidermonkey.GC() * Spidermonkey.dumpObject() * Spidermonkey.printStack() The main one i'm interested in right now is being able to trigger a full garbage collection interactively.
We have a "gc" module (not that it isn't trivial), but like your idea of putting it in a Spidermonkey module. It's somewhat useful even outside of debugging because SM does not know how big native objects are and can be a little bit too unaggressive with the GC in some cases. /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ #include <config.h> #include "gc.h" #include <gjs/gjs.h> static JSBool big_js_gc(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *retval) { JS_GC(context); return JS_TRUE; } JSBool big_js_define_gc_stuff(JSContext *context, JSObject *module_obj) { if (!JS_DefineFunction(context, module_obj, "gc", big_js_gc, 0, GJS_MODULE_PROP_FLAGS)) return JS_FALSE; return JS_TRUE; } GJS_REGISTER_NATIVE_MODULE("gc", big_js_define_gc_stuff)
*** This bug has been marked as a duplicate of bug 595323 ***