Paip. Improve program stability-Best Practices

Source: Internet
Author: User
Tags try catch

Paip. UpgradeProgramStability-Best Practices
Author attilax, email: 1466519819@qq.com

1. Prevent memory usage from rising outofmemory and exit... It is especially important to do it ..

First, test the actual memory value of the program using a tool to obtain a reasonable value.
New Memory (). Start (); monitor memory usage. When the physical memory usage exceeds this value of M, call the setprocessworkingsetsize method to reclaim the memory.

2. Throw a thread. Try catch in the thread body .. Otherwise, an exp is thrown to the main program out .. It is especially important to do it ..

3. Prpgram. Try catch in Cs to find problems with the main program and restart ..

4. Programe. Added the unhandledexception capture in CS ..

5. Network and file operations must be trycatch.

6. Generally, do not use a uniform catch. Especially for Java .. Note that in finally, if you need to close a resource, a try catch will apply.

7. Log, cache, and other files. It is best not to use one file. Multiple files should be generated by time as much as possible .. This prevents any file handle from being released and subsequent file writes from being affected.

Refer:

Paip. improves performance --- high memory usage of C #. Net program and outofmemory Solution
Paip. Solution for automatically exiting without an error in the program-attilax column-blog channel-csdn.net.htm

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.