Search code examples
c++memory-managementwindows-cewindows-mobile-6.5windows-messages

Low memory notifications in Windows CE


Is there a way to get notifications when the available memory goes below a certain limit (user configurable)? I have looked into the WM_HIBERNATE event but it seems the limit for this event is not user configurable and is hard-coded (160KB??). The only way I can think of is to poll the OS periodically (every 5 seconds??) for available memory through GlobalMemoryStats() API and if the available memory goes below the user configured limit then raise an event to the user. Is there a better way?

This notification has to work on devices starting with Windows CE 5.0 & Windows Mobile 6.5


Solution

  • There's nothing inherent in the OS that's going to tell you that memory is below an arbitrary level, no. Either polling in your app or creating a service/driver that does it for you is probebly the best way. Which is "better" would depend on if only one process needs to know about the notification.