[gjs/wip/tko/116-mem-track: 4/4] modules: include signals callback sources to aid debugging
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/tko/116-mem-track: 4/4] modules: include signals callback sources to aid debugging
- Date: Sun, 4 Feb 2018 05:59:19 +0000 (UTC)
commit a9e28252acaa63f4685eed49de6bfa7ec2281ed4
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 file changed, 4 insertions(+)
---
diff --git a/modules/signals.js b/modules/signals.js
index 2abeace7..f433ae5c 100644
--- a/modules/signals.js
+++ b/modules/signals.js
@@ -50,6 +50,7 @@ function _connect(name, callback) {
this._signalConnections.push({ 'id' : id,
'name' : name,
'callback' : callback,
+ 'callbackSource' : callback.toSource(),
'disconnected' : false
});
return id;
@@ -67,6 +68,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;
@@ -81,6 +84,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]