I'm looking for an equivalent to the -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
method that's available on the iPhone. So far I haven't been able to find anything, but I'd like to check before I start writing my own.
Memory on Mac OS X doesn't work quite the same as OS X Touch. Notably, a desktop machine has lots more RAM and will swap memory to disk as apps demand more. As well, there are many applications competing for resources.
The real question is what are you trying to accomplish?
If the answer is use memory efficiently, then you need to focus on minimizing allocations, making sure you have no leaks, and ensuring that your data structures are optimized. Use ObjectAlloc in Instruments to analyze memory usage and figure out where to focus.
However, if the answer is more along the lines of I have a caching subsystem that benefits from lots of memory, but I want to give it back to the system when other apps increase their demands, then you'll want to investigate Snow Leopard's Caching and Purgeable Memory support.
Notably, the two APIs provide a means of aggressively caching data as long as their are system resources, backing off or giving back to the system when their is memory pressure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With