After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593215 - imports.spidermonkey
imports.spidermonkey
Status: RESOLVED DUPLICATE of bug 595323
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2009-08-26 19:38 UTC by Colin Walters
Modified: 2009-09-16 00:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Colin Walters 2009-08-26 19:38:01 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.
Comment 1 Havoc Pennington 2009-08-26 19:46:21 UTC
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)
Comment 2 Colin Walters 2009-09-16 00:26:24 UTC

*** This bug has been marked as a duplicate of bug 595323 ***