webrender icon indicating copy to clipboard operation
webrender copied to clipboard

Memory leak

Open SergeevPavel opened this issue 6 years ago • 4 comments

Hi, thank for your great work. I doing some experiments on using webrender as a renderer for our ui framework and have faced with couple of problems.

I have simple example, that runs on mac os with metal backend. On every frame it sends display list with two rectangles. The problem with this is constant grow of used memory, according to profile on every frame render_impl allocates memory that will never be freed.

Second problem is about jni and shader recompilation. When I do same thing like in first example but throw jni most calls of submit_to_gpu return false (particularly error is OutOfDate, but according to this comment I'm not sure, that it's relevant) which leads to swapchain recreation and shader recompilation. Shader recompilation took time and also lead to huge memory leak.

I use macos 10.14.5 with Intel Iris Pro 1536 MB I will be very grateful if you give me some thoughts about this examples

SergeevPavel avatar Jun 03 '19 16:06 SergeevPavel

@SergeevPavel thanks for the bug report. I am glad to see, that our work is used in a project. For the first problem: I will look into the issue. For the second part. Unfortunately I'm not really familiar with jni, and if you want to know more about that comment, maybe @kvark or @omni-viral could give you a proper explanation about that. For the shader recompilation part, if gfx-backend-metal will have a pipeline cache API like Vulkan it will be faster, the second part bothers me because I thought we are destroying the programs properly. I will try to look in that too.

zakorgy avatar Jun 04 '19 11:06 zakorgy

I don't understand that part about jni. Please describe in more detail.

kvark avatar Jun 04 '19 13:06 kvark

I'm working on lib that wrap webrender into jni interface. When I trying to run event loop on jvm thread it leads to constant errors from gfx-metal inside of render_impl. I don't understand how it connected, but I suppose it maybe explained throw some conflict of own jvm graphics code and gfx-metal. If it will be helpful I will try to reduce example from my lib and attach it here.

Second thing is that every swapchain_recreation consume bunch of memory, that leads to total used memory grow. I'm no sure but for me it also looks like mem leak.

SergeevPavel avatar Jun 04 '19 16:06 SergeevPavel

Thank you for the info @SergeevPavel ! For memory leaks, we are aware that IOSurface objects get lost somehow on resize, and are looking into it.

kvark avatar Jun 04 '19 16:06 kvark