Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help with Qt6/QtLocation

Help with Qt6/QtLocation

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 117 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MyUsernameIsUsername
    wrote last edited by
    #1

    I am having a serious problem right now with Qt 6.10.2 using QtLocation related to memory usage.

    I am using the native Maplibre plugin but I also validated this issue happens with the stock osm (Open Street Maps) plugin so I don't think Maplibre is at fault.

    I ran an overnight test:

    • On Windows 11 the Qt UI application grew from 350MB of RAM to 28GB in 18hours.
    • On an embedded Yocto Linux platform the same application grew from 350MB to 2150MB in 18 hours.
    • The growth is slow and steady I plotted the increase its linear.

    During this test I ran a looping "route" where the map would continually recenter/rotate the map/rotate/move the icon for the current location at 5hz (I know this is frequent but it yields a smooth movement on the map).

    currentLocation is a MapQuickElement that as an Image/MultiEffect(for tinting/color) and a MouseArea in it. I wonder if the MultiEffect on top of the map might be a problem?

    In the most basic terms this is how I interact with the map. I interact with the map like this at 5hz. It seems doing this leads to linear memory growth that has no maximum.

    map.center = QtPositioning.coordinate(nextLat, nextLon)   // recenter
    mapView.map.bearing = targetBearing360                    // heading
    currentLocation.coordinate = QtPositioning.coordinate(lat, lon) // icon position
    currentLocation.rotationValue = rotation                  // icon rotation
    

    Any ideas? I am going to try reverting to Qt 6.9.1 in the meantime which I used the initial version of my project. I'll update with the results.

    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MyUsernameIsUsername
      wrote last edited by
      #2

      Ok I reverted to 6.9.1 and the same issue is present.

      I noticed something interesting though if I minimize the Qt application window (while my test is running) then the RAM levels off instantly. As soon as the UI is visible again the RAM begins to climb at the same rate as before.

      That is a big clue but I am not sure what to make of it.

      Ideas?

      1 Reply Last reply
      0
      • Joe von HabsburgJ Offline
        Joe von HabsburgJ Offline
        Joe von Habsburg
        wrote last edited by
        #3

        I did not work with Quick but I used webengine view + qwebsocketserver + leaflet.js

        //My Obj
        struct  Device{
          QGeoCoordinate coordinate;
          double bearing;
        };
        
        // Websocket server
        void sendToClient(){
          QJsonObj obj
          obj["lat"] = dev.coordinate.latitude();
          ...
        }
        
        // js client
        socket.onmessage = event => {
         const message = JSON.parse(event.data);
         parseData(message)
        }
        

        After you can use leaflet functions for center view and rotate icon.

        2 option have for rotate icon :

        • rotate img tag with css style

        • use leaflet.rotatedMarker.min.js

        1 Reply Last reply
        1
        • GrecKoG Offline
          GrecKoG Offline
          GrecKo
          Qt Champions 2018
          wrote last edited by GrecKo
          #4

          One way you could help diagnose and fast track this issue is by running your app through Heaptrack to find out what leaks (with debug informations and optimizations)

          1 Reply Last reply
          1
          • M Offline
            M Offline
            MyUsernameIsUsername
            wrote last edited by MyUsernameIsUsername
            #5

            Thanks for the replies.

            I originally tried running Maplibre JS via Webengine and that worked but the performance was terrible on an embedded system (based on Raspberry Pi CM4). The native mapping is far superior in pretty much every way.

            Good call on Heaptrack I actually did that last week but I only had a basic report so maybe I need to look at debug optimizations if I understand what you said correctly.

            Here is a graph from heaptrack that confirms there is absolutely an issue. It is allocating memory linearly and from what Heaptrack said the allocations are mostly 32-64 bytes in size.

            I have isolated the issue to anything that recenters/rotates/tilts the map view. If disable all this the memory growth stops. If I adjust the frequency of recentering/rotation the map I can adjust how fast the memory grows. The problem is that to make the map a smooth experience akin to say Google maps these parameters need to be animated at like 30fps at least to achieve really smooth navigation.

            Also since I ruled out the Maplibre plugin (because it happens with the osm plugin too) I am leaning more toward there being a bug in QtLocation/QtPositioning that allows unbounded memory growth. I haven't been able to find a bug yet though still looking.

            image.png

            1 Reply Last reply
            0
            • GrecKoG Offline
              GrecKoG Offline
              GrecKo
              Qt Champions 2018
              wrote last edited by
              #6

              Any possible culprits in the called functions list of Heaptrack?

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved