[gjs/wip/js24: 29/29] add api to get js_bytes
- From: Tim Lunn <timl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/js24: 29/29] add api to get js_bytes
- Date: Tue, 15 Oct 2013 02:15:26 +0000 (UTC)
commit c2b8cc342749da01edd7cc9d470238856ac1d581
Author: Tim Lunn <tim feathertop org>
Date: Mon Oct 7 09:10:59 2013 +1100
add api to get js_bytes
gjs/mem.cpp | 11 +++++++++++
gjs/mem.h | 4 +++-
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gjs/mem.cpp b/gjs/mem.cpp
index 40b9235..6cea88b 100644
--- a/gjs/mem.cpp
+++ b/gjs/mem.cpp
@@ -25,6 +25,7 @@
#include "mem.h"
#include "compat.h"
+#include "gjs/jsapi-util.h"
#include <util/log.h>
#define GJS_DEFINE_COUNTER(name) \
@@ -107,3 +108,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..0fa2ea9 100644
--- a/gjs/mem.h
+++ b/gjs/mem.h
@@ -29,7 +29,7 @@
#endif
#include <glib.h>
-#include "gjs/jsapi-util.h"
+#include "gjs/context.h"
G_BEGIN_DECLS
@@ -75,6 +75,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]