When developing, be sure to control CPU usage and use memory size in time

Source: Internet
Author: User

has been focused on functional development, without attention to CPU and memory. I stumbled across two questions yesterday:

1. After the program starts, nothing is done and the CPU is 50% (single core). Now want to find the reason to reduce the use rate, feel not at all, if usually pay attention to this problem.

2. As the function of the program runs, the memory is growing. Memory leaks also have, but very few, are a few K-K growth, this does not matter. But more crucially, when running the data in the thread, a few super-large maps were created, and it was written that Deletelater automatically frees the memory after the thread runs, but also releases the super-large map, but you don't know when the QT library will delete it. Causes the program memory to change from 20M to hundreds of m at a sudden, and does not degrade. I learned to be smart, after the map data does not need to be clear, this does not affect the subsequent logic. There are no other factors that need to be controlled at this time. It's not easy to develop a complete software.

In addition, the memory consumption is large, the program response is very slow, but my machine memory is obviously 16G, this is why?

When developing, be sure to control CPU usage and use memory size in time

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.