I added a event handler in MyWindowController.AwakeFromNib(),
where should i remove this?
i tried override a function #void Dispose(bool disposing)
but i think it's not called from System.
Please give me some hints!
Try to add handler in ShowWindow(...) and remove in Close(). I don't think you want to handle events when window is invisible?
I simply want to reduct memory usage and want to know why it isn't called #void Dispose(bool disposing) function.
In case of Sub-window(not MainWindow), I tested to be called this function by the-Class-Instance.Dispose();
thanks for reply.
Because you can get circular references (so Dispose isn't called). You need to break the break the loop by removing the event handler outside of Dispose (such as when the window closes).
See here: http://blog.bluetubeinteractive.com/2013/07/memory-management-pitfalls-in-xamarin-ios-pitfall-2.html
Thank you for useful information! I will try
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies