Closed Bug 1553165 Opened 6 years ago Closed 4 years ago

Properly clean up NetworkEventActors

Categories

(DevTools :: Netmonitor, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1439509

People

(Reporter: Honza, Unassigned)

References

(Blocks 2 open bugs)

Details

It looks like instances of NetworkEventActor are cleaned up only when the NetworkMonitorActor is destroyed. This might cause big memory footprint (and performance issues on destroy).

It would be better to clean up NetworkMonitorActors on every navigation (when persistent log is false) and also when the user is clearing the Network monitor panel.

See this code:
https://searchfox.org/mozilla-central/rev/a887c90ea9c19a0b5529a1f5fa351929944887ba/devtools/server/actors/network-monitor.js#204-214

Honza

Priority: -- → P3

I added a simple log into the aforementioned method and it shows that the this._netEvents map is cleared only when closing the entire Toolbox. So, reloads (with Persist Logs == false) are only adding new actors into it (not removing). Clearing Network panel content has also no effect on that array.

Honza

diff --git a/devtools/server/actors/network-monitor.js b/devtools/server/actors/network-monitor.js
--- a/devtools/server/actors/network-monitor.js
+++ b/devtools/server/actors/network-monitor.js
@@ -196,16 +196,18 @@ const NetworkMonitorActor = ActorClassWi
     const actor = this.getNetworkEventActor(data.channelId);
     this.messageManager.sendAsyncMessage("debug:get-network-event-actor:response", {
       channelId: data.channelId,
       actor: actor.form(),
     });
   },

   getNetworkEventActor(channelId) {
+    console.log("getNetworkEventActor " + channelId + ", " + this._netEvents.size);
+
     let actor = this._netEvents.get(channelId);
     if (actor) {
       return actor;
     }

     actor = new NetworkEventActor(this);
     this.manage(actor);
Blocks: dt-leak
No longer blocks: 1553178
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.