|
INTERVIEW QUESTIONS
OPERATING SYSTEMS
SYMBIAN
DETAILS
Question: What is Cleanup mechanism in symbian?
Answer: To handle the exceptions in symbian we used the cleanup stack mechanism.The Symbian exception mechanism is based on leaving.The most important issue here is the Cleanup Stack.
Symbian OS is optimized for low resource usage, and when an unexpected event occurs, there is a need to clean up all the currently allocated objects. To ensure you actually de-allocate ANY object you create, there is a stack, named the “Cleanup Stack”, where you push any object that needs to be de-allocated later. Consider this example:
CDemo* demo = new CDemo; DangerousOperationL(); delete demo; If the DangerousOperationL() leaves, the delete demo will never be reached, hence leaving the demo object allocated. The correct way is to use the cleanup stack as following:
Ex.
CDemo* demo = new CDemo(); CleanupStack:: PushL(demo); DangerousOperationL(); CleanupStack:: PopAndDestroy()
When you create an object with new or NewL, you have to push it on the Cleanup Stack if any action that follows can leave. If you allocate an object with NewLC, it will be already pushed on the Cleanup Stack at the creation.
After you are done with your object, you should destroy it. If the object is already on the Cleanup Stack, you should remove it from the stack with Pop then delete it. Or better, you can call PopAndDestroy to do both of them in a single step .
|
|
|
Category |
Symbian Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7287 users |
Added on |
5/15/2014 |
Views |
66402 |
Rate it! |
|
|
Question:
What is Cleanup mechanism in symbian?
Answer:
To handle the exceptions in symbian we used the cleanup stack mechanism.The Symbian exception mechanism is based on leaving.The most important issue here is the Cleanup Stack.
Symbian OS is optimized for low resource usage, and when an unexpected event occurs, there is a need to clean up all the currently allocated objects. To ensure you actually de-allocate ANY object you create, there is a stack, named the “Cleanup Stack”, where you push any object that needs to be de-allocated later. Consider this example:
CDemo* demo = new CDemo; DangerousOperationL(); delete demo; If the DangerousOperationL() leaves, the delete demo will never be reached, hence leaving the demo object allocated. The correct way is to use the cleanup stack as following:
Ex.
CDemo* demo = new CDemo(); CleanupStack:: PushL(demo); DangerousOperationL(); CleanupStack:: PopAndDestroy()
When you create an object with new or NewL, you have to push it on the Cleanup Stack if any action that follows can leave. If you allocate an object with NewLC, it will be already pushed on the Cleanup Stack at the creation.
After you are done with your object, you should destroy it. If the object is already on the Cleanup Stack, you should remove it from the stack with Pop then delete it. Or better, you can call PopAndDestroy to do both of them in a single step . Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Symbian Interview Questions & Answers - Exam Mode /
Learning Mode
|