Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. Cleanup Stack is
a concept widely used in Symbian OS. It is most suitable to use in
places where dynamic memory is used (allocated) in programming. The
problem with the dynamic memory is that it is solely on the discretion
of the underlying OS whether the request for the memory will succeed or
not. Applications (Requester of memory) must be prepared to handle the
rejection. In large programs dynamic memory is used almost everywhere.
If application adds the code to handle this failure all the time then it
will increase the code size significantly. As Symbian is used mostly on
phones where this increase in the code size will further amplify the
memory allocation failures. Symbian has an ingenious solution to that
problem. When application see that a memory allocation may fail, it
places the earlier allocated memory address to a location which Symbian
is aware. That location is called Cleanup Stack.