Some discussions about how to handle exceptions in applying for memory failure in Symbian applications

Source: Internet
Author: User
If your application does not have to exist, do not catch this exception. Quit directly.
If you want to save some important data, try to save it before exiting.
If the data is very important, it is better to save it periodically.

Mobile phones can crash, and it is not a big deal to exit the program.

If your application is too critical, for example, you cannot survive without this application...
Some memory space can be reserved in advance and used when the memory is insufficient. Or
Reserve enough memory when allocating stacks. Or it is not critical to stop when an exception occurs.
To release less important objects, as long as you stay and let the user live OK...

 

 

 

2nd will exit directly, so you don't need to worry about it. 3rd will swallow this error,
It seems that an error is reported in a dialog box. But I have a bit of knowledge about the 3rd framework.
Comments. This may break down the application logic.

For example, the program is executing an operation and setting a system status.
Except this status. However, the leave is in progress, so the system status is not restored,
Leave was swallowed up by the Framework again. The program does not seem dead, but cannot be
Work frequently. It is better to exit.

You can only trap yourself to identify the cause of the error. For something that can be processed, such
Some errors set by the program, restore the system status, remind the user or continue subsequent operations.
For errors that cannot be processed, call panic to return them.

At this time, the handlecommand (eeikcmdexit) of the UI is not very good,
This is a normal exit method. An exception requires an abnormal exit method.

If leave is in the runl of the activity object, it will enter runerror, which
You have the opportunity to restore the system status. If the error cannot be handled, panic should also be used.

However, leave may cause program logic errors only in part.
If possible, let the system framework handle it.

By Mayflowers

Symbian provides the new (eleave) operation to ensure that the object to be created is either successful or failed. If it fails, leave will be thrown and the application framework will capture and process it, you can also use trap or trapd. the advantage of using it is that you do not need to determine whether the application is successful.

Beover1984 has the advantage of using a terminal. Most operations start with a user, so there is no memory, leave, and network operations fail, leave, no storage space, leave, it can be handled by the Symbian application framework. If it is better, capture it on the logic top layer and give the user a prompt. The user decides whether to retry or something, if you do not want background services, you must handle them. You can close other applications, release disk space, or try again when you leave the elevator.

Qxiaoyuan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.