Post

Replies

Boosts

Views

Activity

CAEAGLLayer add to custom UIWindow cause memory leak after iOS13
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. 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. @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.
1
0
1.1k
Apr ’21
CAEAGLLayer add to custom UIWindow cause memory leak after iOS13
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. 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. @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.
Replies
1
Boosts
0
Views
1.1k
Activity
Apr ’21