[Qgis-developer] Possible memory leak in rendering code

Matthias Kuhn matthias.kuhn at gmx.ch
Mon Apr 22 23:22:30 PDT 2013

Backbuffering solves a lot of issues with the rendering cache. It was 
only introduced on Linux so far (to avoid flickering of the canvas) but 
maybe it should be enabled automatically if rendering cache is enabled.

Most crashes I had, happened due to recursively starting another 
rendering loop out of an existing rendering loop. Normally initiated by 
some user interaction. These user interactions wait in an event queue, 
which is only processed, a) when the rendering loop is finished or b) 
when processEvents is called. The backbuffering option removes the call 
to processEvents. This has some limitations like you are not able to 
incrementally draw features and you are not able to cancel rendering 

If leaving the render cache in the code, I would at least automatically 
enable backbuffering as well for the sake of stability.


On Die 23 Apr 2013 04:25:29 CEST, John C. Tull wrote:
> On Apr 22, 2013, at 2:12 PM, Nyall Dawson <nyall.dawson at gmail.com> wrote:
>>> By the way, it would be a good thing to remove render caching
>>> completely before 2.0. In any case it will need to be reworked when
>>> moving to multi-threaded rendering... it has only a limited
>>> functionality of storing previously rendered map in each layer and
>>> reusing it in case the extent has not changed. Unfortunately the
>>> rendered image is stored directly within QgsMapLayer class - in order
>>> to work properly, the cache should be kept internally within each
>>> QgsMapRenderer instance.
>> -1 from me -- please don't do this! I realise that it has some
>> limitations, but render caching makes a huge difference in speed with
>> my workflow.
>> I frequently use layers based off complex PostGIS views which take a
>> long time to generate. With render caching I'm able to selectively
>> toggle layers on/off or rearrange them for comparison without having
>> to wait for QGIS to request a new version of the view from the PostGIS
>> server. If I switch off render caching then every change to layer
>> visibility or ordering triggers a refresh of the view and a painful
>> wait in QGIS.
>> Obviously an ideal solution would be to cache the PostGIS layer
>> locally, but until that's possible render caching helps a lot...
>> Nyall
> Unfortunately, the render caching feature has never worked on OSX. It is a greyed out option in the settings because the code was never stable on this platform. If it is meant to be a program feature, it would ideally be one that is available on all platforms.
> Regards,
> John
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list