Resource Management

Updated: April 19, 2023

System resources are limited in an embedded environment. Since users can run multiple applications concurrently in a multitasking environment, it isn't always possible to simultaneously satisfy all of the resourcing needs of all applications.

For this reason, system resources may be revoked from a running application when they are needed elsewhere. At any point, it's possible that the resources used by the camera application are required by a higher priority application.

Since there's no way to prevent an application from storing references to allocated buffers, your camera application should call the camera_register_resource() function to request that the operating system temporarily defer the unmapping of buffer memory. Then, whenever resources are needed by higher priority applications, your camera application should receive a CAMERA_STATUS_RESOURCENOTAVAIL status event. When it receives this event, your application should immediately cease processing all buffers and call the camera_deregister_resource() function to let the operating system know that it can proceed to unmap allocated buffer memory.

A timeout is in place that limits the amount of time your application has before resources will be forcefully revoked. For this reason, it is important that your application respond as soon as possible after receiving the CAMERA_STATUS_RESOURCENOTAVAIL status event.