Hi
I‘ve been trying to wrap my head round memory management etc. and noticed that simply raising a UIAlert (with a simple text field, save and cancel buttons) bumps up my memory usage by about 12 to 14mb. The memory doesn’t appear to get released, although it doesn’t keep increasing either.
Is this normal? I know it’s not much, just curious, seems a lot for such a simple tool.
Cheers
Memory usage — how to measure it, I mean — is not a simple thing. UIAlert is implemented in a library, which is going to occupy space in your process's address space even if it doesn't occupy additional physical memory (because it's shared with other processes and already loaded). Using it may cause other libraries and their associated data to be loaded, so you may see a usage bump that you would have seen sometime or other. Using it may also cause data to be cached, which temporarily comes under your memory usage accounting, but can be freed if the memory is needed for other things. And so on.
So, yes, this kind of behavior is normal. You can (and should eventually) use Instruments to check that your app isn't inadvertently holding onto its own memory data structures longer than expected, and you should keep an eye on the usage to make sure that it doesn't keep growing. Other than that, you have no particular reason to think there's anything wrong.