[Pixman] pixman 0.18.2 leaking memory in threaded invocations by cairo on Mac OS X 10.5.8
Dr. Rolf Jansen
rj at cyclaero.com
Fri Jun 25 15:09:25 PDT 2010
Hi,
I am new to this list and quite new to pixman and cairo. The list
archive extends back only to Feb 2010. So, please excuse me, if the
topic has already be touched before, or if there would be a better
forum for discussing the problem. In both cases, I would be glad to
receive a short pointer.
Anyway, here comes my problem.
I programmed a daemon for Mac OS X 10.5.8, that receives commands via
socket connections and utilizes cairo/pixman for producing PNG
graphics using some provided data. The daemon is supposed to run on an
unattended server in 24/7/365 mode, and it may produce up to several
PNGs per second, which may sum-up to some thousands per hour.
The problem is now that the daemon is leaking 256 bytes of memory on
every PNG production. I analysed the problem with an OS X tool called
MallocDebug, and it turned out that the leaked memory was allocated in
pixman. If cairo/pixman is invoked from the main thread only, then I
observe no leaking. Also a first time invocation from any thread does
not result in leaking. If cairo/pixman is invoked from a spawned
thread, then the leak occurs, once the thread is finished.
I read something about pixman utilizing TLS (thread local strorage),
and I suspected that the observed leaking may be somehow related, but
my config.log tells us:
conftest.c:31: error: thread-local storage not supported for this target
However, the behaviour, that the very first invocation does not leak,
regardless whether it occurred from the main or from a spawned thread,
let my think that some caching might be involved into the problem.
Questions:
Is there a pixman_cleanup() routine, that can be called just before a
thread terminates?
Or, is there a way to force pixman to completely initialize itself on
the stack of each new thread with something like alloca()?
Here comes an example of the leaked 256 bytes (big-endian machine).
Looks like it comes from calloc(), doesn't it?
0x00475df0: 00000003 00010000 00042aff 08018000 ..........*.....
0x00475e00: 00070aff 20028888 00040a7f 002082c0 .... ....... ..
0x00475e10: 00000000 00000000 00000000 00000000 ................
0x00475e20: 00000000 00000000 00000000 00000000 ................
0x00475e30: 00000000 00000000 00000000 00000000 ................
0x00475e40: 00000000 00000000 00000000 00000000 ................
0x00475e50: 00000000 00000000 00000000 00000000 ................
0x00475e60: 00000000 00000000 00000000 00000000 ................
0x00475e70: 00000000 00000000 00000000 00000000 ................
0x00475e80: 00000000 00000000 00000000 00000000 ................
0x00475e90: 00000000 00000000 00000000 00000000 ................
0x00475ea0: 00000000 00000000 00000000 00000000 ................
0x00475eb0: 00000000 00000000 00000000 00000000 ................
0x00475ec0: 00000000 00000000 00000000 00000000 ................
0x00475ed0: 00000000 00000000 00000000 00000000 ................
0x00475ee0: 00000000 00000000 00000000 00000000 ................
0x00475ef0: beefdead
Many thanks for any response.
Best regards
Rolf
More information about the Pixman
mailing list