Re: [waffle] [PATCH 2/3] examples: make use of waffle_teardown

2015-01-20 Thread Chad Versace
On 01/15/2015 07:21 AM, Emil Velikov wrote:
> Using this we clear the global state thus the user can call waffle_init()
> multiple times, as things won't get clobbered.
> According to gl_basic we cleanup ~20K of leaks (still reachable) and catch
> a bug in the GL/dri2 loader :-)

We catch a bug! Fantastic.

Recently, I've also been digging through the EGL/dri2 loader interfaces.
And there are many leaks in the EGL code :(

> 
> Before:
> definitely lost: 63 bytes in 4 blocks
> still reachable: 43,695 bytes in 116 blocks
> 
> After:
> definitely lost: 87 bytes in 5 blocks
> still reachable: 23,451 bytes in 55 blocks
> 
> Signed-off-by: Emil Velikov 
> ---
>  examples/gl_basic.c   | 6 +-
>  examples/simple-x11-egl.c | 5 +
>  2 files changed, 10 insertions(+), 1 deletion(-)

Looks good. Patch 2 is
Reviewed-by: Chad Versace 



signature.asc
Description: OpenPGP digital signature
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [PATCH 2/3] examples: make use of waffle_teardown

2015-01-15 Thread Emil Velikov
Using this we clear the global state thus the user can call waffle_init()
multiple times, as things won't get clobbered.
According to gl_basic we cleanup ~20K of leaks (still reachable) and catch
a bug in the GL/dri2 loader :-)

Before:
definitely lost: 63 bytes in 4 blocks
still reachable: 43,695 bytes in 116 blocks

After:
definitely lost: 87 bytes in 5 blocks
still reachable: 23,451 bytes in 55 blocks

Signed-off-by: Emil Velikov 
---
 examples/gl_basic.c   | 6 +-
 examples/simple-x11-egl.c | 5 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/examples/gl_basic.c b/examples/gl_basic.c
index 69418c8..050b8f8 100644
--- a/examples/gl_basic.c
+++ b/examples/gl_basic.c
@@ -34,7 +34,7 @@
 ///each buffer swap.
 
 #define _POSIX_C_SOURCE 199309L // glibc feature macro for nanosleep.
-#define WAFFLE_API_VERSION 0x0103
+#define WAFFLE_API_VERSION 0x0106
 #define WAFFLE_API_EXPERIMENTAL
 
 #include 
@@ -674,6 +674,10 @@ main(int argc, char **argv)
 if (!ok)
 error_waffle();
 
+ok = waffle_teardown();
+if (!ok)
+error_waffle();
+
 #ifdef __APPLE__
 cocoa_finish();
 #endif
diff --git a/examples/simple-x11-egl.c b/examples/simple-x11-egl.c
index 9e218ac..c08fc04 100644
--- a/examples/simple-x11-egl.c
+++ b/examples/simple-x11-egl.c
@@ -33,6 +33,9 @@
 /// This example is too simple; it does not perform proper error checking. For
 /// a complete example with error checking, see gl_basic.c.
 
+#define WAFFLE_API_VERSION 0x0106
+#define WAFFLE_API_EXPERIMENTAL
+
 #include 
 #include 
 
@@ -134,5 +137,7 @@ main()
 waffle_config_destroy(config);
 waffle_display_disconnect(dpy);
 
+waffle_teardown();
+
 return 0;
 }
-- 
2.1.3

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle