Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memleaks related to un-freed mmal objs
I've been using rascam in a long-lived process that periodically creates and drops a SimpleCamera (that has an encapsulated SeriousCamera) periodically or on demand. The process mainly hosts an actix-web HttpServer and periodically saves an image from the raspberry pi camera, or serves a live feed from it through the front-end. Eventually, creating SimpleCamera fails with the following error message: mmal: mmal_vc_component_create: failed to create component 'vc.null_sink' (1:ENOMEM) mmal: mmal_component_create_core: could not create component 'vc.null_sink' (1) Failed to activate SimpleCamera: MMAL error: Unable to create null sink for preview Status: ENOMEM It seems that rascam has a memory leak in GPU memory. Upon examination, I've discovered some pointers to mmal objects created with mmal_*_create that were never freed with mmal_*_destroy. This commit addresses this issue by cleaning up mmal objects which should prevent (or at least reduce) GPU memory leaks. Note that I've been checking the GPU memory of a Raspberry Pi 3B with the following commands: vcgencmd get_mem malloc vcgencmd get_mem reloc After applying this commit, the periodic usage of SimpleCamera appears to not leak the GPU memory. Signed-off-by: Stephen Seo <seo.disparate@gmail.com>
- Loading branch information