On 08/10/2010 12:53, Soeren Sandmann wrote:
static pixman_image_t *
make_image (pixman_format_code_t format)
{
uint32_t *bits;
uint8_t bpp = PIXMAN_FORMAT_BPP (format) / 8;
+ pixman_image_t *image;
bits = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * bpp);
- return pixman_image_create_bits (format, WIDTH, HEIGHT, bits, WIDTH * bpp);
+ image = pixman_image_create_bits (format, WIDTH, HEIGHT, bits, WIDTH *
bpp);
+
+ if (image&& bits)
+ pixman_image_set_destroy_function (image, on_destroy, NULL);
}
I need a "return image" there, of course. Somehow this didn't actually
cause the test to fail. Maybe image was in eax or something.
Even with this fix, the cygwin tinderbox is still failing (silently) [1]. The
alphamap process grows to 2G in size and then mmap() starts failing.
It looks like this is because we are still leaking the alphamap pixmaps.
Attached is a patch to fix this, although I am not very familiar with the
pixman API, so this might not be the best way to do this :-)
It would be better if this failure wasn't silent, I only noticed it by accident.
[1] http://tinderbox.freedesktop.org/builds/2010-10-21-0012/logs/pixman/#check
>From 84e218f10e50c8aff59c7c1b3bbd0c4171ae0335 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.tur...@dronecode.org.uk>
Date: Sun, 24 Oct 2010 15:58:39 +0100
Subject: [PATCH] Plug another leak in alphamap test
Even after commit e46be417cebac984a858da05e61d924889695c9e alphamap
test is still leaking the alphamap pixmap, leading to mmap() failures
on cygwin
Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk>
---
test/alphamap.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/alphamap.c b/test/alphamap.c
index 6013e63..9fb8969 100644
--- a/test/alphamap.c
+++ b/test/alphamap.c
@@ -82,6 +82,7 @@ create_image (pixman_format_code_t format,
pixman_format_code_t alpha_format,
pixman_image_set_alpha_map (image, alpha,
alpha_origin_x, alpha_origin_y);
+ pixman_image_unref (alpha);
}
return image;
@@ -217,6 +218,10 @@ run_test (int s, int d, int sa, int da, int soff, int doff)
}
}
+ pixman_image_set_alpha_map (src, NULL, 0, 0);
+ pixman_image_set_alpha_map (dst, NULL, 0, 0);
+ pixman_image_set_alpha_map (orig_dst, NULL, 0, 0);
+
pixman_image_unref (src);
pixman_image_unref (dst);
pixman_image_unref (orig_dst);
--
1.7.2.3
_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman