Some time ago, I went online to find out how to release the memory. However, you cannot find it. Today, I am continuously testing and viewing the parent window of the view.
Nslog (@ "% @", self. View. superview. superview );
At this time, I found that every page Jump, the parent window and the Child Window of the parent window still exist. If the page Jump continues, and the memory of the useless window is not released, the memory will increase, like a ladder, there will never be an end.
If you don't talk much about it, you should focus on it.
-(Void) viewwilldisappear :( bool) animated {[Super viewwilldisappear: animated]; // stop timer when image hiding if ([Timer isvalid]) {[Timer invalidate];} // nslog (@ "% @", self. view. subviews); // [self. view removefromsuperview]; for (uiview * temp in self. view. subviews) {[temp removefromsuperview];} // --- release the memory --- // set the question array // allthequestions = nil ;}
I release useless pointers before the page is about to disappear. For example, in the code above
Allthequestions is a variable array (nsmutablearray) that stores 40 elements. If the memory of this array is not released before the page Jump, the code above is shown. Use instrument to detect such:
After I release the memory, for example:
The key is to assign a useless pointer to it without nil.