On 2013-03-24 07:28:03, Marwan Tanager wrote:
> While browsing the bug tracker for related issues, I found the one at 
> http://bugs.pwmt.org/issue95 which points out the version as not 
> suffering from this problem. I built it and experimented. The result was that 
> the total amount of memory consumed by scrolling through the length of the 
> 1300-pages document was comparable to the one with this patch. So, there must 
> be something messy happening with cairo_surface_destroy when it's get called 
> from the timeout function while scrolling. Maybe it's non-reentrant and some 
> mess happens when it's called concurrently from both the timeout function and 
> the render thread.  But if that's the case, then why doesn't it free the 
> memory 
> after the first time, even when there is no scrolling? Also, I tried to 
> experiment with mutexes around the cairo_surface_destroy calls on the render 
> thread and zathura_page_widget_update_surface but nothing surprising has 
> happened.

I played a bit with the code tonight. What puzzles me is that it works
for the first time but not for any subsequent purge operations. As far
as I can tell, the ref counters of the surface are 1 and thus
cairo_surface_destroy should free the image. cairo_surface_destroy is
definitely called, but I really don't know why nothing happens [1].

I played with some gdk_threads_{enter,leave} calls around the destroy to
no avail.

I will follow up to the other mails in this thread later this week.

[1] Nothing in the sense of that the first call gives a huge decrease in
RES usage and subsequent calls only a small decrease.

Sebastian Ramacher
zathura mailing list

Reply via email to