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