Analysis and Processing of a memory growth problem (3)

Source: Internet
Author: User

Working with colleagues in the framework department, valgrind has passed a lot of tests and verification and has not found a specific code segment for Memory leakage. For C and C ++ programs, memory growth may occur, and we may naturally think about memory leakage. Sometimes, this direction may not be certain.

In the process of solving this problem, another memory growth problem occurs. This is an obvious phenomenon. It is a process that clearly shows the constant growth of the internal memory. After the process is stopped, the memory will be released directly and the memory will grow slowly next time. The idea is to check the code to see if there is any memory leakage. Because the program does not use new or malloc, there is no direct memory operation. In this way, it is more difficult to locate Memory leakage, and the valgrind information cannot be seen as Memory leakage. Later, the analysis may be that the program uses the while (true) method to cyclically scan and process the data. In the middle of this process, the operation information on the memory database will be stored, stored in the session, because the interface for clearing the session is not called, the data structure in the session is getting bigger and bigger, which leads to a constant increase in memory. Later, I modified the code and called the session clearing interface to restore the memory to normal.

With the idea of this problem, I will go back and look at this problem:

1. This problem is caused by exceptions in the database.

2. Check the log. The database connection is not released.

3. If the database connection is not released, will the session data be continuously increased?

How to verify this problem is a difficult task. I tried it. When the database throws an exception, the database connection is not released and then called, in this case, memory increases. It can be determined that the database connection will not be released, and the session structure will continue to grow.

However, as to why the database connection cannot be released, this issue still needs to be further analyzed by colleagues from the Framework department.

Sometimes, if you change your mind, the problem can be easily explained.

Come on!

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.