Is there any equivalent in UWP app for "didRecieveMemoryWarning" of ios.
I would like to detect SystemOutOfMemory in UWP application , before it throws any error.
Thanks in advance.
Noorul
Is there any equivalent in UWP app for "didRecieveMemoryWarning" of ios.
I would like to detect SystemOutOfMemory in UWP application , before it throws any error.
Thanks in advance.
Noorul
Faywang - MSFT
On
In UWP, you can use AppMemoryUsageIncreased event to detect, it is raised when the app's memory consumption has increased to a higher value in the AppMemoryUsageLevel enumeration.
Windows.System.MemoryManager.AppMemoryUsageIncreased += MemoryManager_AppMemoryUsageIncreased;
private void MemoryManager_AppMemoryUsageIncreased(object sender, object e)
{
// do something
}
Yes , we need to use
MemoryManager.AppMemoryUsageIncreasedevent, thanks to @Faywang - MSFT for the answer , but we need to do little more work.This
MemoryManager.AppMemoryUsageIncreasedwill be called even while app launch . I am bit confused of this behavior, finally found that we need to check for memory usage inside that event.here is the exact code, which i used
Here is the thread in which I got this answer. How to detect "OutOfMemory" warning in UWP app