The iOS operating system sends your app a warning when its memory use approaches the limit of available device memory.
The operating system sends low-memory warnings using a best-effort approach, and your app needs to respond to them as quickly as possible.
Out of Memory crash often happens when the system increases faster than the warnings relieve memory pressure.
Make sure your app changes its approach for allocating memory when it receives a memory warning—adopting a conservative policy of looking for opportunities to release objects or reduce their size as it uses them.
NAOSDK is continuously looking for ways to improve user experience, but crashes can sometimes slip through, which we understand is very frustrating.
That’s why, when The application is running out of memory, NAOSDK will stop all running services.
This information is tracked in the naoServices.naolog file.
CNAOServiceManager::writeToLog Memory Warning : stop service manager
Applications using NAOSDK must implement the OS’s callback interface for low memory warning.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMemoryWarning:) name: UIApplicationDidReceiveMemoryWarningNotification object:nil];
- (void) handleMemoryWarning:(NSNotification *)notification { //TODO: release objects or reduce size }
This interface can give the application the ability to safely exit the user experience.
This is a new static interface in NAOServicesConfig that will allow you to disable this memory management behavior from NAOSDK.
Setting this value to false means that NAOSDK will continue to work despite this warning.
If the application does nothing at that time, it is very likely that the application will crash at any time and in any module, including NAOSDK, because the memory management will be corrupted.
/**
*@brief activate / deactivate Memory warning managment (this value is true by default)
*@param[in] use true to activate
*@return None
*/
+ (void)handleMemoryWarning:(bool)activate;
If services are stopped due to a Memory Warning. All NAOSDK clients receive the following error: “Memory Warning : Stop and destroy service”