[gjs/mem-track: 5/5] modules: include signals callback sources to aid debugging
- From: Johan Bilien <jobi src gnome org>
- To: svn-commits-list gnome org
- Subject: [gjs/mem-track: 5/5] modules: include signals callback sources to aid debugging
- Date: Mon, 8 Jun 2009 13:29:02 -0400 (EDT)
commit aa636d7986025393e32f1b391bab1a0b0d507712
Author: Tommi Komulainen <tko litl com>
Date: Mon Jan 26 14:05:26 2009 +0000
modules: include signals callback sources to aid debugging
When debugging memory leaks from JS_DumpHeap leaked signal connections
show up unhelpfully as:
:Object -> _signalConnections :Array -> Object :array_dslots[42]
-> callback :Function -> __parent__ :Block -> ...
With this patch in parallel to 'callback' there'll be an additional node
such as
callbackSource :string ({function (item) { me._doSomething(item); })
helping to further narrow down the search for the source of the leak.
---
modules/signals.js | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules/signals.js b/modules/signals.js
index 0905e53..8d9ca26 100644
--- a/modules/signals.js
+++ b/modules/signals.js
@@ -48,6 +48,7 @@ function _connect(name, callback) {
this._signalConnections.push({ 'id' : id,
'name' : name,
'callback' : callback,
+ 'callbackSource' : callback.toSource(),
'disconnected' : false
});
return id;
@@ -65,6 +66,8 @@ function _disconnect(id) {
// set a flag to deal with removal during emission
connection.disconnected = true;
+ delete connection.callback;
+ delete connection.callbackSource;
this._signalConnections.splice(i, 1);
return;
@@ -79,6 +82,7 @@ function _disconnectAll() {
while (this._signalConnections.length > 0) {
_disconnect.call(this, this._signalConnections[0].id);
}
+ delete this._signalConnections;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]