C + + Memory leak checking method

Source: Internet
Author: User
Overloading Global New

Can write multiple versions of new, but only a delete;
Overloading the global new will cause some mismatched crosstalk, especially in the case of third-party libraries;

my Way out.

Reload new for a single class;
Primitive types cannot be overloaded, so the use of a method similar to malloc is allocated;
My Cfan Open Source Library implements this approach

operating system hook mechanism

http://my.oschina.net/chunquedong/blog/271248
These are not cross-platform, use is not convenient;

Valgrind and other tools

Non-cross-platform;
It is difficult to provide timely feedback unless continuous integration is achieved;
Sometimes it causes the program to crash; it is easy to make false positives (perhaps the implementation of the tool itself, but these three are problematic: Valgrind, Rational Purify, XCode insruments);

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.