Does WP8 DeviceStatus.ApplicationCurrentMemoryUsage Property take into acount native allocations?

StackOverflow https://stackoverflow.com/questions/18826967

سؤال

I can't find this specified in the documentation, so I'm wondering if anyone has any experience regarding this?

I need to know about all the memory the application is consuming, therefor a sum of what was allocated in the native project I'm referencing and what is managed in the managed application.

The documentation I'm looking at can be found at: http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.info.devicestatus(v=vs.105).aspx

Bonus: While we are at it, can I find out how much memory is allocated to each part of the application (native vs managed)?

هل كانت مفيدة؟

المحلول

Yes, DeviceStatus.ApplicationCurrentMemoryUsage does include the total memory the application is using: both Native and Managed.

You can ask GC.GetTotalMemory how much managed memory it thinks is used, but I've found that this isn't reliable.

As per MSDN:

Retrieves the number of bytes currently thought to be allocated.

Update:

There is a brief example of how to determine how close you are to your memory limits at DeviceStatus.ApplicationMemoryUsageLimit Property, but it doesn't explicitly call out different types of memory. I suspect that is as close as you are going to get to a reference at MSDN for now.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top