Does the state pattern in an iPhone application -- In my case, a relatively light-weight utility application -- use too much memory?
The state pattern, as I understand it, uses several classes; these classes represent different states. All of the different state objects are instantiated and stored in different pointer variables until the state is needed, at which point it is set to a curState
object.
I figure that I could lazy load each state object to save some memory and loading time; I could then release the objects if my app receives a memory warning.
But what I wanted to know is does this pattern utilize too much memory for general usage in an iPhone OS application? Should iPhone developers stay away from this pattern? Is there a different pattern that is better suited to the iPhone OS?