Is there any way for me to detect when I receive Memory Warnings from the OS and free memory accordingly?
I have some large dictionaries that I need to read from. There are 4 of them, I only need to do a lookup on them sporadically, and they eat up a lot of memory, but I can't seem to find a way to load and eject them from memory as needed. This means that I end up needing to always keep all 4 in memory, and if the iPhone has been running for awhile and is using up a fair chunk of its memory, the OS will kill my app because of these dictionaries.
I've tried setting all their references to null right after I use them, but this doesn't seem to free them very quickly, and puts me in trouble if I need to use the same one twice in a row (it gets allocated twice). Do I need to set their references to null and then call for a gc sweep right away? Ideally I'd like to be able to avoid doing this unless I'm receiving memory warnings.
Thanks for any help.