How to detect memory leak and how to resolve it in C++? 如何回答比较好?
r*n
2 楼
overload了new和delete来做个profiler?
r*y
3 楼
auto_ptr?
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
s*u
4 楼
1. 眼睛 2. 工具
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
y*g
5 楼
盖头~?
【在 s****u 的大作中提到】 : 1. 眼睛 : 2. 工具
s*u
6 楼
hi
【在 y*******g 的大作中提到】 : 盖头~?
a*l
7 楼
if you can't detect it, it's probabily small and can leave it alone. if it is serious, you can detect it immediately.
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
p*o
8 楼
Depending on which platform you are developing on, there are different memory profilers that can help you find leaks. On windows you can use boundschecker, on Linux you can try valgrind. Microsoft also provides some facilities. Do a search on MSDN if you are on windows platform. One of the drawbacks is that when you run your programs with these tools, sometimes the performances are very poor, so they may or may not work for you. If you don't have access to any of these tools, you can overload ne
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
r*t
9 楼
Very good question. Should answer as two questions: 1) how to detect, and 2) how to resolve 1) unit test with detection software (perfmon or purify or bouncecheck or ..) 2) lot of difference answers: 2A) read lines to check new/delete pair, sometimes you could draw complete state machines for every new/memory_allocation operations to verify the match of delete operation 2B) tools (most tools overload new/delete with in-process or out-process data collection with source lines/call stacks, like bo
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
s*u
10 楼
.....
【在 r*******t 的大作中提到】 : Very good question. : Should answer as two questions: 1) how to detect, and 2) how to resolve : 1) unit test with detection software (perfmon or purify or bouncecheck or ..) : 2) lot of difference answers: : 2A) read lines to check new/delete pair, sometimes you could draw complete state machines for every new/memory_allocation operations to verify the match of delete operation : 2B) tools (most tools overload new/delete with in-process or out-process data collection with source lines/call stacks, like bo
L*r
11 楼
tool is good but it just 2 lines of code to add the functionality to detect memory leak in vc++.
r*t
12 楼
If your program is big and it never exist/quit in a normal and orderly manner(for example, i was working in a big project whose compiled binaries total 700MB, and the program could only be KILLED, not quited), VC++ couldn' t detect.
detect
【在 L*********r 的大作中提到】 : tool is good but it just 2 lines of code to add the functionality to detect : memory leak in vc++.
L*r
13 楼
you can make check point and dump memory leak whenever you prefer in vc++. tool should be easier to use but not always necessary
couldn'
【在 r*******t 的大作中提到】 : If your program is big and it never exist/quit in a normal and orderly : manner(for example, i was working in a big project whose compiled binaries : total 700MB, and the program could only be KILLED, not quited), VC++ couldn' : t detect. : : detect
d*d
14 楼
1. tools, such as purify/memprof.... 2. design a memory pool to manage the memory. 3. good habbit.
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?