pace icon indicating copy to clipboard operation
pace copied to clipboard

Memory leak in IE?

Open Kilowhisky opened this issue 10 years ago • 5 comments

I have pace.js installed on my blank page and just have it running a get request over and over again and this is what IE is saying is being retained between executions.

capture

Am i just looking at this wrong?

Kilowhisky avatar Nov 25 '15 19:11 Kilowhisky

Is there any reason why ajax monitor keeps a record of every XHRRequestTracker but doesn't destroy the tracker?

https://github.com/HubSpot/pace/blob/master/pace.js#L553

See this.elements? Its never used and just stores every request it tracks.... for eternity.

AjaxMonitor = (function() {
    function AjaxMonitor() {
      var _this = this;
      this.elements = [];
      getIntercept().on('request', function() {
        return _this.watch.apply(_this, arguments);
      });
    }

    AjaxMonitor.prototype.watch = function(_arg) {
      var request, tracker, type, url;
      type = _arg.type, request = _arg.request, url = _arg.url;
      if (shouldIgnoreURL(url)) {
        return;
      }
      if (type === 'socket') {
        tracker = new SocketRequestTracker(request);
      } else {
        tracker = new XHRRequestTracker(request);
      }
      return this.elements.push(tracker);
    };

    return AjaxMonitor;

  })();

Kilowhisky avatar Nov 25 '15 19:11 Kilowhisky

Our backbone SPA slows down after a while in Edge (not in Chrome), after a few hundred ajax requests it becomes unusable. I tracked this issue down and found XHRRequestTracker. I expect this to be the same problem as mentioned here. If I disable Pace, there is no problem.

image

Unsure if this is the same problem and don't understand why it's only in Edge.

EdwinStoteler avatar Dec 28 '15 13:12 EdwinStoteler

Yea i just branched and fixed it. No issues since the fix. Coffee script is a screwy language.

Kilowhisky avatar Dec 28 '15 19:12 Kilowhisky

Currently, I fix it as follows.

Pace.on('done', function () {
  Pace.sources[0].elements = [];
});

luncheon avatar Mar 30 '18 02:03 luncheon

Is pace.js still being maintained? Is there a release with this hole plugged?

totszwai avatar Oct 26 '18 14:10 totszwai