C + + positioning new memory leak __c++

Source: Internet
Author: User
Debug.cpp: Defines the entry point for a console application.
//
#include "stdafx.h"
#include <assert.h>
#include <iostream>


#ifdef _DEBUG
#define Debug_clientblock   New (_client_block, __file__, __line__)
#else
#define Debug_clientblock
endif
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#ifdef _DEBUG
#define NEW Debug_ Clientblock
#endif



void Exit ()
{
    int i = _CrtDumpMemoryLeaks ();
    _wassert (_crt_wide ("Memory Leak"), _crt_wide (__file__), __line__);
    ASSERT (i==0);
}
int _tmain (int argc, _tchar* argv[])
{
    atexit (Exit);
    int* p = new int ();
    System ("pause");
    return 0;
}

Navigate to the number of new rows without delete as shown in the figure

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.