Re: [waffle] [PATCH 07/33] linux: plug a memory leak
On 17/07/14 04:45, Chad Versace wrote: On 07/07/2014 10:28 AM, Emil Velikov wrote: Chad, do you have a plan/idea how to handle this ? I'm assuming that your plan is to tackle this once waffle_init is gone/replaced with a better solution (issue #7). There appears to be a straightforward solution: add a new API call waffle_finish(void) that tears down the global state set up by waffle_init(). The caveat is that if the user makes the calls in this sequence: waffle_init(platform=any_egl_platform) ... waffle_finish() ... waffle_init(platform=a_different_egl_platform) BOOM! ...then older versions of Mesa crashes inside libEGL. I think the issue existed as recent as Mesa 10.0. Nasty. Did you/someone else manage to track down the fix and have it back-ported or we are talking about old mesa versions where we don't do stable releases anymore ? Despite the danger of crashing when on buggy drivers, I think adding waffle_finish() to the API is a good idea. And as you point out, deprecation of waffle_init() will lead to a different, but orthogonal solution, to memory leaks. Ack. Perhaps I'll add waffle_finish at the same time as I break the API while adding WGL. -Emil ___ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle
Re: [waffle] [PATCH 07/33] linux: plug a memory leak
On 07/07/2014 10:28 AM, Emil Velikov wrote: Chad, do you have a plan/idea how to handle this ? I'm assuming that your plan is to tackle this once waffle_init is gone/replaced with a better solution (issue #7). There appears to be a straightforward solution: add a new API call waffle_finish(void) that tears down the global state set up by waffle_init(). The caveat is that if the user makes the calls in this sequence: waffle_init(platform=any_egl_platform) ... waffle_finish() ... waffle_init(platform=a_different_egl_platform) BOOM! ...then older versions of Mesa crashes inside libEGL. I think the issue existed as recent as Mesa 10.0. Despite the danger of crashing when on buggy drivers, I think adding waffle_finish() to the API is a good idea. And as you point out, deprecation of waffle_init() will lead to a different, but orthogonal solution, to memory leaks. ___ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 07/33] linux: plug a memory leak
On linux_platform_destroy we close all the handles for the different libgl* providers, yet we do not free the memory for the base struct linux_platform, causing a memory leak. In reality the memory will never be freed ('still reachable' by valgrind) as we do not have a API to call platfrom-destroy() and effectively cleanup this and other memory hunks. Chad, do you have a plan/idea how to handle this ? I'm assuming that your plan is to tackle this once waffle_init is gone/replaced with a better solution (issue #7). Cc: Chad Versace chad.vers...@linux.intel.com Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/waffle/linux/linux_platform.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/waffle/linux/linux_platform.c b/src/waffle/linux/linux_platform.c index 7301c80..56f6fe6 100644 --- a/src/waffle/linux/linux_platform.c +++ b/src/waffle/linux/linux_platform.c @@ -56,6 +56,7 @@ linux_platform_destroy(struct linux_platform *self) ok = linux_dl_close(self-libgles1); ok = linux_dl_close(self-libgles2); +free(self); return ok; } -- 2.0.0 ___ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle