Search code examples
macosviewdealloc

why the windowController is dealloc but the subview is not dealloc


I add a subview cutView in a windowController.

when the cut action is done, I set cutView be nil and its delegate be nil. I thought the cutView will be dealloc.

So when I do cutAction again, I init a curView again.

when I close the Window, I find the memory is not decrease.

then I add a log in the dealloc of cutView and window, I found the window's dealloc is called but the cutView is never called.

Then I googled but did not find solution.

Thanks for help ~ ^_^


Solution

  • Just like Leo said, there is strong reference to the view so it can not be dealloc. 😁