Bug 1058584 - LIST keeps too many long strings in memory. r=florian,a=Standard8 on a CLOSED TREE
authoraleth <aleth@instantbird.org>
Tue, 26 Aug 2014 17:30:52 +0200
changeset 16511 8bbfe92295cb6f7d3b5e556d59a50ae3b55b96a9
parent 16510 9234fc769ce05d39c1a80b1d9c4bba0d7136a697
child 16512 94e3688ab02718dd6dddf87077adb730b2ab4513
push id1234
push usermbanner@mozilla.com
push dateMon, 13 Oct 2014 17:59:18 +0000
treeherdercomm-esr52@b5a0add9fb18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, Standard8
bugs1058584
Bug 1058584 - LIST keeps too many long strings in memory. r=florian,a=Standard8 on a CLOSED TREE
chat/modules/imXPCOMUtils.jsm
chat/protocols/irc/ircBase.jsm
--- a/chat/modules/imXPCOMUtils.jsm
+++ b/chat/modules/imXPCOMUtils.jsm
@@ -45,17 +45,17 @@ function scriptError(aModule, aLevel, aM
     let logKey = logKeys.join(".");
     if (logKey in gLogLevels) {
       logLevel = gLogLevels[logKey];
       break;
     }
   }
 
   // Only continue if we will log this message.
-  if (logLevel > aLevel && (!"imAccount" in this))
+  if (logLevel > aLevel && !("imAccount" in this))
     return;
 
   let flag = Ci.nsIScriptError.warningFlag;
   if (aLevel >= Ci.imIDebugMessage.LEVEL_ERROR)
     flag = Ci.nsIScriptError.errorFlag;
 
   let scriptError =
     Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
--- a/chat/protocols/irc/ircBase.jsm
+++ b/chat/protocols/irc/ircBase.jsm
@@ -785,16 +785,20 @@ var ircBase = {
     "322": function(aMessage) { // RPL_LIST
       // <channel> <# visible> :<topic>
       let name = aMessage.params[1];
       let participantCount = aMessage.params[2];
       let topic = aMessage.params[3];
       // Some servers (e.g. Unreal) include the channel's modes before the topic.
       // Omit this.
       topic = topic.replace(/^\[\+[a-zA-Z]*\] /, "");
+      // Force the allocation of a new copy of the string so as to prevent
+      // the JS engine from retaining the whole original socket string. See bug
+      // 1058584. This hack can be removed when bug 1058653 is fixed.
+      topic = topic ? topic.normalize() : "";
 
       this._channelList.push(new ircRoomInfo(name, topic, participantCount, this));
       // Give callbacks a batch of channels of length _channelsPerBatch.
       if (this._channelList.length % this._channelsPerBatch == 0) {
         let channelBatch = this._channelList.slice(-this._channelsPerBatch);
         for (let callback of this._roomInfoCallbacks) {
           callback.onRoomInfoAvailable(channelBatch, this, false,
                                        this._channelsPerBatch);