No delete,free after 1.new,malloc.
2. Create kernel objects (such as Createfile,createmutex,createthread) without releasing the kernel object handle.
3. Create a memory-mapped file, createfilemapping,mapviewoffile after CloseHandle (), UnmapViewOfFile
4. After the creation of GDI objects, such as loadicon,loadimage,createimagelist and so on, no destroy dropped
5. After the DC is created, such as GetDC (), the DC handle is not freed
6. Keep the virtual address space VirtualAlloc (), and then submit the physical memory without releasing
Memory leak explanationTo put it simply is to apply for a piece of memory space, after use is not released. Its general performance is the longer the program runs, the more memory consumed, the end of the total memory, the entire system crashes. A piece of memory that is requested by the program, and none of the pointers point to it, the memory is compromised.edit this section of the leak classificationIn the manner in which they occur, memory leaks can be categorized into 4 categories:(1). Frequent-onset memory leaks. The code that has a memory leak is executed multiple times, causing a memory leak each time it is executed.(2). Accidental memory leaks. The code that occurs with a memory leak only occurs under certain circumstances or procedures. The frequent and incidental are relative. For a given environment, the occasional may become a frequent occurrence. So test environments and test methods are critical to detecting memory leaks.(3). Disposable memory leak. The code that has a memory leak is executed only once, or because of an algorithm flaw, there will always be a single and one memory leak. For example, allocating memory in the constructor of a class does not release that memory in the destructor, so a memory leak occurs only once.(4). An implicit memory leak. The program keeps allocating memory while it is running, but it does not release memory until the end. Strictly speaking, there is no memory leak, because the final program frees up all of the requested memory. But for a server program, it can take days, weeks, or months to run out of memory, which may result in the eventual exhaustion of all of the system's memory. So, we call this kind of memory leak as an implicit memory leak.edit this paragraph harmFrom the user's point of view of the program, the memory leak itself will not produce any harm, as a general user, do not feel the existence of memory leaks. What really harms is the accumulation of memory leaks, which ultimately consumes all the memory of the system. In this sense, a one-time memory leak is harmless because it does not accumulate, and the implicit memory leak is very harmful because it is more difficult to detect than frequent and accidental memory leaks.Edit the performance of this segment memory leakMemory leaks or what happens to the system after the resource runs out. CPU depletion: It is estimated that the machine is unresponsive, the keyboard, the mouse, and the network and so on. This is often seen on windows, especially in the poison. Process ID Exhausted: Unable to create new process, serial port or Telnet could not be created. Hard drive exhaustion: The machine is dying, swapping memory can not use, the log also can't use, dead is very normal. Memory leak or memory exhaustion: New connections cannot be created and free memory is less. There are a lot of memory leaks, but in order to have some consequences, this process is an infinite loop, a service process. Of course, the kernel is also infinite loop, so if the kernel has a memory leak, the situation is even worse. Memory leaks are an error that is difficult to locate and track. At present, there is no useful tool (of course, user space has some tools, static analysis, but also dynamic analysis, but to find the kernel of memory leaks, no good open source tools) memory leaks and object reference count has a great relationship, coupled with C + + There is no automatic garbage collection mechanism, and if the memory is not freed manually, the problem arises. If you want to avoid this problem, or to start from the code, good coding habits and norms, is to avoid the wrong begotten. In general we often say that the memory leak is the heap memory leakage. Heap memory is that the program is allocated from the heap, of any size (the size of the memory block can be determined during the program run), and the freed memory must be displayed after use. The application generally uses functions such as malloc,realloc,new to allocate a piece of memory from the heap, and after use, the program must be responsible for the corresponding call free or delete to release the memory block, otherwise, this piece of memory can not be reused, we say this memory leak.edit this section memory leak Detection Tool (attached) some memory leak detection tools 1.ccmalloc-linux and Solaris under the simple use of memory leaks and malloc debugging libraries for C and C + + programs. 2.dmalloc-debug Malloc Library. The malloc () debug Library, written by Bruce Perens, in the 3.Electric fence-linux distribution. A program that detects memory leaks under 4.leaky-linux. 5.leaktracer-linux, Solaris, and HP-UX to track and analyze memory leaks in C + + programs. Written by Johan Lindh, 6.memwatch-is an open source C language Memory error Detection tool, mainly through GCC precessor. 7.valgrind-debugging and profiling Linux programs, aiming at programs written in C and C + +. 8.kcachegrind-a visualization tool for the profiling data generated by Cachegrind and CallTree. 9.IBM Rational purifyplus-helps developers to identify performance and reliability errors in C + +, managed. NET, Java, and VB6 code. Purifyplus combines features such as memory error and leak detection, application performance description, and code coverage analysis into a single, complete toolkit. 10.parasoft insure++-is an automatic detection tool for run-time errors of C + + applications, it can automatically monitor C + + program, found that there are memory damage, memory leaks, pointer errors and I/O errors. And through the use of a series of unique technology (SCI technology and mutation test, etc.), thorough inspection and testing of our code, accurate positioning error accurate location and give detailed diagnostic information. Can be run as a plug-in for microsoft Visual C + +. 11.Compuware DevPartner for Visual C + + BoundsChecker suite-run error detection and debugging tool software designed for C + + developers. Run as a plug-in for Microsoft Visual Studio and C + + 6.0. 12.Electric Software glowcode-includes a memory leak check, code profiler,function call tracing, and so on. Provide both C + + and. NET developers with complete error diagnostics and Run-time profiling kits. 13.Compuware DevPartner Java edition-contains several major modules, including Java memory detection, code coverage testing, code performance testing, thread deadlock, and distributed applications. 14.Quest jprobe-Analysis of Java memory leaks. 15.ej-technologies jprofiler-is a full-featured Java profiling tool designed to analyze J2SE and EE applications. It combines the analysis of CPU, thread, and memory in a powerful application. The 16.BEA jrockit-is used to diagnose the Java memory leak and to identify the root cause, specifically for the Intel platform and optimized for maximum performance on Intel hardware.