Describe the bug
Capturing through the unicam driver leaks CMA memory after the device is closed.
To reproduce
- Build libcamera
- Identify current CMA consumption
- cat /proc/meminfo | grep Cma
- Run qcam for a bit then exit
- Calculate difference in CMA usage
- cat /proc/meminfo | grep Cma
- echo $((198732-187880))
- Each repeated launch consumes another ~10mB of CMA.
Expected behaviour
There should be no considerable consumption of CMA when an application closes and releases buffers.
(even if there is a bug in libcamera, the driver should have released all resources on close)
Actual behaviour
Each iteration and launch of qcam (from libcamera) consumes about 10mB from CMA. I doubled the allocation on the unicam from 4 buffers of 1080p to 8 buffers of 1080p, and the memory leak doubled to ~20mB per iteration.
System
-
Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
-
Which OS and version (cat /etc/rpi-issue)?
- Raspberry Pi reference 2019-07-10
-
Which firmware version (vcgencmd version)?
Jul 9 2019 14:42:57
Copyright (c) 2012 Broadcom
version 6c3fe3f096a93de3b34252ad98cdccadeb534be2 (clean) (release) (start_x)
- Which kernel version (
uname -a)?
Describe the bug
Capturing through the unicam driver leaks CMA memory after the device is closed.
To reproduce
Expected behaviour
There should be no considerable consumption of CMA when an application closes and releases buffers.
(even if there is a bug in libcamera, the driver should have released all resources on close)
Actual behaviour
Each iteration and launch of qcam (from libcamera) consumes about 10mB from CMA. I doubled the allocation on the unicam from 4 buffers of 1080p to 8 buffers of 1080p, and the memory leak doubled to ~20mB per iteration.
System
Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
Which OS and version (
cat /etc/rpi-issue)?Which firmware version (
vcgencmd version)?uname -a)?