Bug report #4083

Line layer labeling eats up all memory

Added by Sandro Santilli over 13 years ago. Updated about 12 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Labelling
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14066

Description

At high zoom levels, layer with new layer labeling activated consume lots of memory. So much to eventually render the machine unusable.

Il'll attach a shapefile with the data I'm testing this with.

To reproduce:

- Open the shapefile as a layer
- Zoom in as much as possible on the left-most node
- Enable labeling

This is happening as of 3ac604f (1.7.0+)

I haven't tried with POINT or POLYGON layers.

un_dump.shp (476 Bytes) Sandro Santilli, 2011-07-14 05:01 AM

un_dump.dbf (206 Bytes) Sandro Santilli, 2011-07-14 05:01 AM

un_dump.shx (124 Bytes) Sandro Santilli, 2011-07-14 05:01 AM

bug4083.qgs (9.23 KB) Sandro Santilli, 2011-07-14 10:41 AM

bug4083-2.qgs (9.23 KB) Sandro Santilli, 2011-07-14 10:51 AM

Associated revisions

Revision 17e864bb
Added by Martin Dobias over 13 years ago

Labeling: clip geometries to current extent if they are not completely inside. Also fixes #4083

History

#1 Updated by Martin Dobias over 13 years ago

I am unable to reproduce the issue here. Could you please try to provide a sample project file with configured labeling and map canvas zoomed in?

#2 Updated by Sandro Santilli over 13 years ago

It's not that easy, as if I zoom in enough to reproduce the problem I end up being unable to get control of the machine, so have to kill qgis which then fails saving the project...

#3 Updated by Sandro Santilli over 13 years ago

The attache project is at a zoom level good enough to see memory growing. Zoom further to kill the machine...

#4 Updated by Sandro Santilli over 13 years ago

Second version of project file manually tweaked to make the problem more visible.

#5 Updated by Martin Dobias over 13 years ago

  • Assignee set to Martin Dobias

Thanks. Now I am able to reproduce the problem.

The labeling library tries to create a huge number of label candidates. The number of candidates is approximately (line length) / (label width) and that is a lot when zoomed in.

I think this should be solved by clipping lines that are not entirely in the view. This would also solve the problem of missing labels when zoomed in (= labels outside current extent).

#6 Updated by Martin Dobias over 13 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

I have added clipping of input geometries in 17e864b which fixed that.

It's in master branch. I will rather not commit that to 1.7 branch since the clipping might have further side effects I am not aware of.

#7 Updated by Sandro Santilli over 12 years ago

  • Pull Request or Patch supplied set to No
  • Crashes QGIS or corrupts data set to No
  • Affected QGIS version set to master
  • Status changed from Closed to Reopened

I'm still using 1.7 and this remains the most hit issue I have. Your commit cherry-picks cleanly in 1.7, I'm giving it a try there. The worst that can happen with clipping is an exception, but since qgis uses the C-API it'll be a NULL return which you're handling by skipping labeling for that feature (if I read the code correctly).

I'm also guessing the patch is not in 1.8 as I don't see any other commit referenced in "Associated revisions". It'll be important to backport at least there IMHO.

#8 Updated by Sandro Santilli over 12 years ago

Alright, I did hit one of those drawbacks pretty easily :)
That was: ST_Intersection returns a geometry of a different type, with the consequence of the code taking who knows what path, a popup window showing complaining about unknown geometry type and the UI entering the infinite rounding circle :) Oops

#9 Updated by Giovanni Manghi over 12 years ago

  • Status changed from Reopened to Feedback

can you test with master? thanks.

#10 Updated by Alister Hood over 12 years ago

  • Category changed from Symbology to Labelling

#11 Updated by Paolo Cavallini about 12 years ago

  • Target version set to Version 2.0.0

#12 Updated by Giovanni Manghi about 12 years ago

  • Assignee deleted (Martin Dobias)

Sandro Santilli wrote:

Alright, I did hit one of those drawbacks pretty easily :)
That was: ST_Intersection returns a geometry of a different type, with the consequence of the code taking who knows what path, a popup window showing complaining about unknown geometry type and the UI entering the infinite rounding circle :) Oops

it seems to work fine on the latest master, please leave feedback.

#13 Updated by Giovanni Manghi about 12 years ago

  • Status changed from Feedback to Closed

Closing for lack of feedback. I assume that this was fixed. Please reopen if necessary.

Also available in: Atom PDF