[gjs/wip/js24] add api to get js_bytes



commit 0b78d5ef34413e24485255dc80dc994679fedb84
Author: Tim Lunn <tim feathertop org>
Date:   Mon Oct 7 09:10:59 2013 +1100

    add api to get js_bytes

 gjs/mem.cpp |   10 ++++++++++
 gjs/mem.h   |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gjs/mem.cpp b/gjs/mem.cpp
index 40b9235..a8f88e6 100644
--- a/gjs/mem.cpp
+++ b/gjs/mem.cpp
@@ -107,3 +107,13 @@ gjs_memory_report(const char *where,
         g_error("%s: JavaScript objects were leaked.", where);
     }
 }
+
+guint
+gjs_memory_get_js_bytes(GjsContext* js_context)
+{
+    JSContext *context;
+
+    context = (JSContext*) gjs_context_get_native_context (js_context);
+
+    return JS_GetGCParameter (JS_GetRuntime (context), JSGC_BYTES);
+}
diff --git a/gjs/mem.h b/gjs/mem.h
index 1ee2604..79fd499 100644
--- a/gjs/mem.h
+++ b/gjs/mem.h
@@ -30,6 +30,7 @@
 
 #include <glib.h>
 #include "gjs/jsapi-util.h"
+#include "gjs/context.h"
 
 G_BEGIN_DECLS
 
@@ -75,6 +76,8 @@ GJS_DECLARE_COUNTER(interface)
 void gjs_memory_report(const char *where,
                        gboolean    die_if_leaks);
 
+guint gjs_memory_get_js_bytes(GjsContext* js_context);
+
 G_END_DECLS
 
 #endif  /* __GJS_MEM_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]