Skip to content

Fly View ProximityRadarMapView causes extreme RAM growth and crash at high map zoom levels #14567

Description

@Niki-dev12

Have you checked the latest release for fixes?

  • Yes, I’ve tested on the latest release

Description

Expected Behavior
The proximity radar should render normally at every map zoom level without causing excessive memory usage.
Current Behavior
When a vehicle publishes DISTANCE_SENSOR telemetry, repeatedly zooming deeply into the Fly View map causes QGroundControl memory usage to increase rapidly until the application becomes unresponsive or crashes.
One diagnostic run recorded:
Peak QGC RSS: approximately 2.9 GB
Peak QGC PSS: approximately 2.9 GB
Peak container memory: approximately 5.3 GB
Several gigabytes of anonymous memory allocations
Normal process heap remained approximately 99 MB
The issue stops when the ProximityRadarMapView block is disabled in FlyViewMap.qml.
Steps To Reproduce
Connect QGroundControl to an ArduPilot vehicle publishing DISTANCE_SENSOR messages.
Open Fly View.
Confirm that the proximity radar circle appears around the vehicle.
Zoom deeply into the map.
Continue zooming in and out.
Monitor QGroundControl RAM usage.
QGC memory grows rapidly and may eventually crash.
Additional Details
The suspected problem is in ProximityRadarMapView.qml:
var scaleLineMeters = Math.round(leftCoord.distanceTo(rightCoord))
_ratio = scaleLinePixelLength / scaleLineMeters
At a sufficiently high zoom level, 100 pixels can represent less than 0.5 meters. Math.round() then produces zero:
_ratio = 100 / 0
This makes _ratio infinite. The value is used to size the proximity radar circle:
width: proximityValues.maxDistance * 2 * _ratio
height: proximityValues.maxDistance * 2 * _ratio
A QML Canvas fills this circle. Qt may therefore attempt to allocate an extremely large or invalid rendering buffer, producing several gigabytes of anonymous memory allocations.
A potential fix is to avoid rounding and validate the distance:
function calcSize() {
const scaleLinePixelLength = 100
const leftCoord = map.toCoordinate(Qt.point(0, 0), false)
const rightCoord = map.toCoordinate(Qt.point(scaleLinePixelLength, 0), false)
const scaleLineMeters = leftCoord.distanceTo(rightCoord)

if (!isFinite(scaleLineMeters) || scaleLineMeters <= 0) {
    _ratio = 0
    return
}

_ratio = scaleLinePixelLength / scaleLineMeters

}
The rendered diameter could also be limited defensively:
readonly property real maximumDiameter:
Math.max(map.width, map.height) * 4

readonly property real requestedDiameter:
proximityValues.maxDistance * 2 * _ratio

width: isFinite(requestedDiameter)
? Math.min(requestedDiameter, maximumDiameter)
: 0

height: width
The DISTANCE_SENSOR message triggers the visualization, but the message handling itself does not appear to leak memory. The uncontrolled QML Canvas dimensions appear to cause the large allocations.

Platform

Linux

Flight Stack

ArduPilot

System Information

QGC Version: 5.0.8
QGC build: Self-built from the Stable_V5.0 branch, commit 85c425d3e8d77087c20c5f78e3f23de64f7ab4dd
Operating System: Ubuntu 20.04
Build environment: Docker
Runtime packaging: Docker build and self-built AppImage
Graphics renderer: Mesa software rasterizer (swrast_dri.so)
Flight Controller: [enter your flight-controller model]
Autopilot Software: ArduPilot [enter firmware type and version]

Log Files and Screenshots

Diagnostic files available:
summary.json
memory_samples.csv
events.log
qgc.log
Screenshot showing the proximity radar circle
Diagnostic summary:
{
"samples": 12,
"duration_s": 33.044,
"peak_qgc_rss_mb": 2884.793,
"peak_qgc_pss_mb": 2906.973,
"peak_container_memory_mb": 5334.016,
"snapshots": 3
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions