How to Find A Memory Leak
2011-11-11 16:47
471 查看
Remember that only unexpected increases in memory usage suggest a memory leak. For example, if you check memory in the Directions application after starting it for the first time and check it again after calculating a complex route, the memory page number
increases. In this case, however, it is an expected increase because the Directions application needed to allocate some memory to calculate and store the route. The best method of determining whether or not a memory leak exists is to perform the same
operation multiple times within a single application. An application must allocate temporary memory to perform a new task for the first time. Thereafter, the application can either re–use existing allocated memory or re–allocate the same amount of memory if
it was already freed. In either case, the total number of allocated pages should not increase at a value greater than the previous increase.
To locate a memory leak, use the following process:
Find the memory leak – Detect the presence of a memory leak in the system, given a particular reproducible sequence. You should be able to identify a specific process, but demonstrating an overall increase in committed system memory can
qualify a memory leak as well.
Isolate the memory leak – Determine the exact location in the source code where the un–freed allocation occurs. This can be a lengthy and tedious process, requiring specific tools, trial–and–error, and teamwork with the original author
of the code.
Fix the memory leak – After the first two steps are completed, this is easy. Fixing the memory leak usually involves adding some code to free the memory in the questionable code path.
相关文章推荐
- Howto find native code memory leak in Android
- Howto find native code memory leak in Android
- pmap study: how to find a memory leak.
- How to debug native memory leak in anroid
- How To Find The Best Memory Foam Mattress Topper?
- Using the Kernel Debugger to Find a Kernel-Mode Memory Leak
- How to detect memory leak issue
- Umdhtools.exe: How to Use Umdh.exe to Find Memory Leaks
- When is a Leak not a Leak? Using Heapshot Analysis to Find Undesirable Memory Growth
- How To Find Where The Memory Is Growing For A Process (Doc ID 822527.1)
- Memo: How to use UMDH to detect memory leak
- How to use umdh to check Windows memory leak
- C++ shared memory leak, how to clear shared memory?
- how to debug memory-leak
- How to use windbg to detect memory leak
- When is a Leak not a Leak? Using Heapshot Analysis to Find Undesirable Memory Growth
- How to find a file in MS-DOS
- Enhancement--How to Find a Screen Exit for T-code
- How to find a laptop for me
- OpenVMS - How to Find which Processes Are Using a Specific Pagefile