[Pixman] pixman 0.18.2 leaking memory in threaded invocations by cairo on Mac OS X 10.5.8

Soeren Sandmann sandmann at daimi.au.dk
Wed Jun 30 00:04:06 PDT 2010


Hi,

> 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.

Thanks for reporting the bug.
 
> 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

That error message is somewhat misleading. It is a GCC error that _it_
doesn't support the use of __thread on Mac OS X.

Pixman instead uses pthreads for thread local storage on Mac OS X, and
the problem you are seeing is related to that. Basically we need to
free the stored data when a thread exists.

The patch included is an attempt at fixing this. If you can test it,
that would be appreciated. There is a tarball here:

        http://www.daimi.au.dk/~sandmann/pixman-0.19.1.tar.gz

which has the patch included.

It seems we have the same problem on Windows. Unfortunately, I don't
really have any idea how to fix it there. If anyone can help out, that
would be appreciated.


Thanks,
Soren





More information about the Pixman mailing list