XSL
XSL

Reputation: 3055

Detect when memory limit is reached

Is there a built-in event I can subscribe to that will let me know if my app has gone over the memory limit? I think the standard is 180mb for WP8 and 90mb for WP7 but how can I have an event thrown when this threshold is reached so that I can free some space?

Upvotes: 0

Views: 325

Answers (1)

Oren
Oren

Reputation: 3248

There are no events that you can subscribe to. You can create a background thread that constantly monitors your memory usage by calling into DeviceStatus.ApplicationCurrentMemoryUsage, but this will prevent the phone from going into power collapse (i.e. you'll trigger work on the CPU when it otherwise would have been asleep).

The best way to combat memory issues is to design for them during development - there are a number of articles on monitoring and profiling during development which should get you started:

Upvotes: 2

Related Questions