To tack on a note to 5ound's answer: pay attention to the level of the memory warning. Prior to iOS 3.2 there was no way to distinguish between warnings of different severity (i.e. is the OS just sitting on a bunch of UIImages it can clear or is there really no memory left?). in 3.2 onwards you can check the level of the memory warning to determine how to react. In my experience level 1 warnings are constant, unavoidable and largely meaningless, so I wouldn't take drastic action in response to them. Although level 2 warnings are not necessarily a sign of impending doom you should probably take them seriously and start clearing any caches you can, etc.
There's a good discussion of the different levels here: http://stackoverflow.com/questions/2915247/iphone-os-memory-warnings-what-do-the-different-levels-meanhttps://stackoverflow.com/questions/2915247/iphone-os-memory-warnings-what-do-the-different-levels-mean
P.S. - This is more of a comment to 5ound's answer but I don't have enough rep to comment so this was my only option...