Re: Memory leaks in cairo bindings



On Thu 18 Dec 2014 15:15:10 Barry Scott wrote:
I am trying to track down a problem with leaking cairo_t context structs
when using cairo from python. I running under an up to date fedora 20
system. (I suspect that other structs are leaking as well, but I have not
deep dived them yet).

The attached example program can be run under valgrind to show the leak.
The program takes a repeat count that you can use to tell the leak from the
startup overhead.

      python gdk-cairo-leak.py 10

I think the bug is in the reference counting of the cairo_t struct.
After creation the ref_count is 2 that that means that it will never be
freed as the python object will be deleted causing cairo_destroy to be
called that will take the ref count down to 1 but not 0 required to free
the storage.

Is there a mecahnism to mark the cairo_create and not needing an extra
cairo_reference call?

Have look further I think I have a clue about the bug.

Why is pycairo_dealloc being used to release an object created and wrapped by 
GI using the box mechanism?

The semantics of pycairo and pygi cannot be mixed right?

Barry



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]