导致VC不能释放的几个原因

时间:2023-03-09 03:46:30
导致VC不能释放的几个原因
  1. delegate的属性不是weak
  2. NSTimer没有invalidate
  3. block中的强引用
  4. 调用了performSelector,退出时没有cancelPerformSelectorsWithTarget

    This method sets up a timer to perform the aSelector message on the current thread’s run loop. The timer is configured to run in the default mode (NSDefaultRunLoopMode).

    performSelector其实就是定时器,会强引用object。如果delay很长的话,就会被导致object很长时间不会被释放。

相关文章