Based on this link I added the events to handle memory during background execution. MemoryManager.AppMemoryUsageLimitChanging event fires on app launch. But while moving the app to background and bringing to foreground again, the event doesn't seem to fire. However, OnSuspending is firing for me.
I tried out the sample here which fires the events correctly. But I could not find out any difference from this app to mine. Is there anything extra I should do to get these events correctly?
Also, one point I noticed is that, if I comment out the MainPage UI in the sample above, the events fail to fire there too!
答案 0 :(得分:0)
可能是由于MSDN对Xbox One UWP应用程序的这个已知问题:
部分强制执行后台应用的内存限制
在后台运行的应用的最大内存占用量为128 MB。在Xbox One上的当前版本的UWP中,当应用程序移动到后台时,如果超过此限制,您的应用程序将被暂停。如果您的应用已在后台运行时超出限制,则目前不会强制执行此限制 - 这意味着如果您的应用在后台运行时超过128 MB,它仍然可以分配内存。
此问题目前尚无解决方法。应用程序应相应地管理其内存使用情况,并在后台运行时继续保持在128 MB的限制之下。