locked
Programmatically checking memory usage during runtime?

    Question

  • I've been using the cocos2dx framework to build cross platform mobile games and the new windows 8.1 universal port is great. However, I'm having some memory issues with long running processes where too many textures get loaded on low memory devices.

    Now, cocos2dx does provide a function to purged unused textures to lower the device's memory footprint (kind of like garbage collection). It's not hooked up to anything in the win 8.1 port of cocos2dx , but on other platforms like iOS and android, it is called in OS-driven memory warning callbacks and things like that.

    I'm wondering if windows 8.1 contains a similar low memory callback or at the very least a way to check available process memory at runtime so that i can call this purge cache method only when memory is below a certain threshold. I'm using xaml/c++ right now for these games so i'd be looking for a compatible api.

     

    Tuesday, December 23, 2014 5:13 AM

All replies

  • What memory characteristics are you looking for?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 23, 2014 7:03 PM
    Moderator
  • Available memory to the process during runtime would be necessary. Really, anything that could tell me with almost 100% certainty that I would receive an out of memory exception after another 16-32 MB of allocation or so. That way i can preemptively clear caches and regain some memory.

    Wednesday, December 24, 2014 2:03 AM