Delphi a way to deal with memory leaks and tips

Source: Internet
Author: User
Delphi is to manually release the memory, if the client program has leaked, it may not be a big problem, but if you are using Delphi to do the service-side program, there is a leak, a long time will occupy a lot of memory, Until the server program closes the reboot. So the memory leak is still harmful. And there are a lot of leaks in the program, but also a bad phenomenon, to be corrected. Add the following code to the first sentence of the program execution: {$IFDEF Debug}reportmemoryleaksonshutdown: = debughook<>0; {$ENDIF} Then, if the program is leaking, the program will be the end of the error, but this error can only know the class type and quantity, there is no specific code line number. and the whole project content, how to quickly find leaks? The answer is to develop good habits in testing, Add this sentence to the project. Because we debug the program, it will be a module to debug. Then exit normally. This makes it very effective to find leaks. Even if the leak error dialog box shows the content is not very specific, but in debug debugging, the scope of the code executed is limited. So we can also quickly find out where the leaks are. I just use this to solve a lot of leaks. I wonder if you have this habit of Delphi fans?

Delphi a way to deal with memory leaks and tips

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.