avatar
面试问题C++ memory leakage# Programming - 葵花宝典
w*n
1
How to detect memory leak and how to resolve it in C++?
如何回答比较好?
avatar
r*n
2
overload了new和delete来做个profiler?
avatar
r*y
3
auto_ptr?

【在 w*****n 的大作中提到】
: How to detect memory leak and how to resolve it in C++?
: 如何回答比较好?

avatar
s*u
4
1. 眼睛
2. 工具

【在 w*****n 的大作中提到】
: How to detect memory leak and how to resolve it in C++?
: 如何回答比较好?

avatar
y*g
5
盖头~?

【在 s****u 的大作中提到】
: 1. 眼睛
: 2. 工具

avatar
s*u
6
hi

【在 y*******g 的大作中提到】
: 盖头~?
avatar
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++?
: 如何回答比较好?

avatar
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++?
: 如何回答比较好?

avatar
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++?
: 如何回答比较好?

avatar
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

avatar
L*r
11
tool is good but it just 2 lines of code to add the functionality to detect
memory leak in vc++.
avatar
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++.

avatar
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

avatar
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++?
: 如何回答比较好?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。