w*****n 发帖数: 9 | 1 How to detect memory leak and how to resolve it in C++?
如何回答比较好? |
r********n 发帖数: 7 | 2 overload了new和delete来做个profiler? |
r*******y 发帖数: 290 | 3 auto_ptr?
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
|
s****u 发帖数: 118 | 4 1. 眼睛
2. 工具
【在 w*****n 的大作中提到】 : How to detect memory leak and how to resolve it in C++? : 如何回答比较好?
|
y*******g 发帖数: 6599 | 5 盖头~?
【在 s****u 的大作中提到】 : 1. 眼睛 : 2. 工具
|
s****u 发帖数: 118 | 6 hi
【在 y*******g 的大作中提到】 : 盖头~?
|
a****l 发帖数: 8211 | 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 发帖数: 7 | 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 发帖数: 8550 | 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 发帖数: 118 | 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 发帖数: 92 | 11 tool is good but it just 2 lines of code to add the functionality to detect
memory leak in vc++. |
r*******t 发帖数: 8550 | 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 发帖数: 92 | 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 发帖数: 2050 | 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++? : 如何回答比较好?
|