I am working on a video project, using openGL to draw.
I want to add the view of the video to a new horizontal UIWindow when the video is full screen, and then return to the original UIWindow when it is turned back to half screen.
But at this time, I found that every time I rotate, the memory will rise, and not fall back.
I use XCode instruments for memory debugging, but Allocations shows that the video will fall back every time it returns to half screen.
I try to App back to the background, the memory will also be released.
I ruled out the memory leak of my code. Also found
The CAEAGLLayer object seems to have some relationship with UIWindow.
And the function *native_window_begin_iosurface()* called by IOSurface when it is created.
Does anyone know the principle of this.
I want to add the view of the video to a new horizontal UIWindow when the video is full screen, and then return to the original UIWindow when it is turned back to half screen.
Code Block UIViewController *landscapeVC = [[UIViewController alloc] init]; UIWindow *landscapeWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; landscapeWindow.windowLevel = 1000; landscapeWindow.hidden = NO; landscapeWindow.rootViewController = landscapeVC; [landscapeWindow addSubview: _playerView]; [UIView animateWithDuration:[CATransaction animationDuration] animations:^{ self.playerView.frame = landscapeWindow.bounds; }];
But at this time, I found that every time I rotate, the memory will rise, and not fall back.
I use XCode instruments for memory debugging, but Allocations shows that the video will fall back every time it returns to half screen.
I try to App back to the background, the memory will also be released.
I ruled out the memory leak of my code. Also found
The CAEAGLLayer object seems to have some relationship with UIWindow.
Code Block @interface CAEAGLLayer : CALayer <EAGLDrawable> { @private struct _CAEAGLNativeWindow *_win; }
And the function *native_window_begin_iosurface()* called by IOSurface when it is created.
Does anyone know the principle of this.