Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for potential memory leak #1855

Merged
merged 1 commit into from
Aug 27, 2015
Merged

Fix for potential memory leak #1855

merged 1 commit into from
Aug 27, 2015

Conversation

massimocode
Copy link
Contributor

We detected that when we remove a component binding from the page (via a knockout if binding) then for some reason our viewModel still lives in the heap. The retainer (in the memory profiler) seems to be the "currentViewModel" variable... I wonder if it is required once the viewModel has been disposed? Because setting it to null like this seems to fix the problem and completely remove the viewModel from the heap. Is there another way this gets cleaned up that we're missing?

We detected that when we remove a component binding from the page (via a knockout if binding) then for some reason our viewModel still lives in the heap. The retainer (in the memory profiler) seems to be the "currentViewModel" variable... I wonder if it is required once the viewModel has been disposed? Because setting it to null like this seems to fix the problem and completely remove the viewModel from the heap. Is there another way this gets cleaned up that we're missing?
@brianmhunt
Copy link
Member

Thanks @massimoahmadi – great catch. This looks okay to me, offhand. I'll flag this for 3.4 in hopes it'll get reviewed.

Offhand, it looks straightforward and innocuous to me.

@chessels
Copy link

It looks like #1855 is the only open issue for the 3.4.0 milestone. The fix looks okay to me.

It would be great to get 3.4.0 out the door!

@brianmhunt
Copy link
Member

Thanks @chessels !

mbest added a commit that referenced this pull request Aug 27, 2015
Fix for potential memory leak
@mbest mbest merged commit 4bfa0b8 into knockout:master Aug 27, 2015
@mbest
Copy link
Member

mbest commented Aug 27, 2015

I've merged this.

@rniemeyer rniemeyer mentioned this pull request Aug 30, 2015
10 tasks
@massimocode massimocode deleted the patch-1 branch September 2, 2015 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants