Post

Replies

Boosts

Views

Activity

OpenGL memory leak when tanslate between different UIWindows
Hello, I am working on a product that uses CAEAGLLayer to draw images. I will move CAEAGLLayer from one UIWindow to another UIWindow. But at this time I found that my memory will keep growing. And this phenomenon will only appear after 13 systems. Below is my code using CAEAGLLayer: Objective-C [self _deleteFramebuffer];   glGenFramebuffers(1, &_framebuffer);   glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);   glGenRenderbuffers(1, &_renderbuffer);   glBindRenderbuffer(GL_RENDERBUFFER, _renderbuffer);   [_glContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:_eaglLayer];   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _renderbuffer);       glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &_backingWidth);   glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &_backingHeight); Does anyone knowns why? Thank you, Harold
2
0
980
Feb ’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.
1
0
967
Feb ’21