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

Memory leak when repeatedly adding/removing KVO observers on an object. #504

Closed
rupertdaniel opened this issue May 18, 2016 · 4 comments
Closed

Comments

@rupertdaniel
Copy link

There seems to be a memory leak when repeatedly adding/removing KVO observers on an object.

The attached sample project demonstrates the issue.

  1. Unzip, build and run app
  2. Press "Update Name Property"
  3. Launch Task Manager and look for "KVOBug.exe". Notice the memory continuously growing as the app is executing.

A lot of the memory allocation seems to occur in _addNestedObserversAndOptionallyDependents and _addKeyObserver, but then never gets freed when the observer is removed.

KVOBug-memoryleak.zip

@DHowett-MSFT
Copy link

DHowett-MSFT commented May 18, 2016

Incidentally, this could be caused in part by the same root issue as #500!
Thanks for the report.

@DHowett-MSFT
Copy link

Sorry, I meant #501.

@DHowett-MSFT
Copy link

Have you continued seeing this since the associated object fix for #501?

@rupertdaniel
Copy link
Author

Sorry for the delay in replying.

I've re-run the attached demo project and unfortunately I'm still seeing the same behaviour, memory usage grows and it seems to never be reclaimed.

Here is a screen grab from the memory profiler showing where the area the allocations are occurring.

screenshot 2016-07-01 08 30 35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants