Cleanup stack
Encyclopedia
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 dynamic memory is the sole discretion of the underlying OS whether the request for memory allocation shall succeed or not. Application
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...

s (Requester of memory) must be prepared to handle the rejection. In large programs dynamic memory is used almost everywhere. If an application frequently adds the code to handle this failure then it will increase the code size significantly. Symbian is used mostly on phone
Phone
Within phonetics, a phone is:* a speech sound or gesture considered a physical event without regard to its place in the phonology of a language* a speech segment that possesses distinct physical or perceptual properties...

s where this increase in the code size will further amplify the memory allocation failures. Symbian features an ingenious solution to that problem. When an application notes a memory allocation may fail, it places the earlier allocated memory address to a location which Symbian is aware of. That location is called Cleanup Stack. In the event of failure, Symbian knows that whatever resource is placed on the Cleanup Stack needs be freed. This way all the resources are freed when a program crashes (or Leaves). This freeing is performed automatically by the Symbian OS. Applications die peacefully without worrying who would clean up the mess left after them.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK