tbranyen / github-viewer

GitHub Viewer.
MIT License
366 stars 59 forks source link

Memory leak in backbone.layoutmanager #22

Closed lachezar closed 10 years ago

lachezar commented 11 years ago

I have noticed a memory leak in the application and I managed to isolate it in backbone.layoutmanager.js plugin on lines 307-310 (if those lines are commented out, the leak is not present any more).

        return parent.once("afterRender", function() {
          // Trigger the afterRender and set hasRendered.
          completeRender();
        });

How to reproduce it:

  1. Use Chrome dev tools's profile section to take heap snapshots.
  2. Go to http://githubviewer.org/org/matchbox
  3. Press repeatedly on paulswartz and on stevemarcus (toggle between them).
  4. Take a snapshot.
  5. Repeat step 3 and 4 several times and observe the increase in memory consumption (forcing garbage collection does not release any memory).

If lines 307-310 in backbone.layoutmanager.js are commented out, then the memory consumption is not increasing when repeating step 3 and 4.

I know that this bug is for the backbone.layoutmanager project, but I see that the version there is different from the one used for github viewer, so I decided to report it here (it might be already fixed in backbone.layoutmanager??).

No memory leak

Memory leak

tbranyen commented 10 years ago

This appears fixed in the latest I just merged into master.