由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 有什么工具可以检查内存泄漏么
相关主题
你们认为OO思想十几年后会被淘汰么?高手请指点
c++问题这是住一晚就能拿3万点吧 IHG Accelerate
Angular放弃service直接用controller如何福利贴 how to write a winning resume (Part 1)
[bssd]Golang还不错C# equivalent of #ifdef _DEBUG
围棋与软件开发:Choose Backlog Items That Serve Two PurposePh.D.(Computational Biology) in CS Department at Old Dominion University
Facebook’s New Face-Recognition Software Is Scary Good
相关话题的讨论汇总
话题: smart话题: release话题: c++话题: ptr话题: memory
进入Programming版参与讨论
1 (共1页)
t*****l
发帖数: 121
1
每次都是内存出问题,都不知道去哪里找,郁闷
z***y
发帖数: 42
2
valgrind for linux

【在 t*****l 的大作中提到】
: 每次都是内存出问题,都不知道去哪里找,郁闷
n****g
发帖数: 14743
3
找人帮你代码走读
点出你的不良习惯

【在 t*****l 的大作中提到】
: 每次都是内存出问题,都不知道去哪里找,郁闷
n****g
发帖数: 14743
4
pc-lint可以,其实有很多静态代码检查工具的。不过要钱的。

【在 t*****l 的大作中提到】
: 每次都是内存出问题,都不知道去哪里找,郁闷
D*********s
发帖数: 555
5
like purify

【在 n****g 的大作中提到】
: pc-lint可以,其实有很多静态代码检查工具的。不过要钱的。
r*******q
发帖数: 50
6
Carefully use C++ and you can almost have NO memory/resource leack,
memory overrun. And you do almost NOTHING in your daily programming
by achieving this aim.
I really don't understand why so many people have memory problem...

【在 t*****l 的大作中提到】
: 每次都是内存出问题,都不知道去哪里找,郁闷
t*****l
发帖数: 121
7
.NET底下有些函数可以用来检查内存泄漏
花了几个小时,看了帮助文档,总算学会了
不查不知道,一查吓一跳,存在泄漏的地方比我想象得要多得多
一条一条改过来了。
哎,还是自己编程习惯太不好了,怎么才能改变呢?

【在 n****g 的大作中提到】
: pc-lint可以,其实有很多静态代码检查工具的。不过要钱的。
r*******q
发帖数: 50
8
对于C++来说,一条就够了:不用"裸"的new。对内存以外的资源也适合。
只要做到了这一条,你一般来说是不会有内存泄漏问题的,内存溢出也基本上
不会发生,或者说一旦发生可以检测出来。
在积累一定代码后,在你的C++程序中应该是看不到new/delete和其它内存分配
函数的。而且你的C++程序和没有这些积累的代码几乎没有区别。更重要的是
你不需要老是记着去调用delete。你完全可以把delete忘了。你根本不需要什么
检测内存泄漏的软件,因为出现泄漏的概论几乎为0.
C++提供了很多优秀的特性,但很多人却用得很垃圾...

【在 t*****l 的大作中提到】
: .NET底下有些函数可以用来检查内存泄漏
: 花了几个小时,看了帮助文档,总算学会了
: 不查不知道,一查吓一跳,存在泄漏的地方比我想象得要多得多
: 一条一条改过来了。
: 哎,还是自己编程习惯太不好了,怎么才能改变呢?

u****u
发帖数: 229
9
很多测的都不准的,不能全信
c********e
发帖数: 383
10
i take it like a joke.
maybe it can be done, but for pretty much all mid and up scale project,
none of them ended up like that. u always have to put extra brain to think
about mems all the time. at least for realtime networking stuff, thats my
feeling.
I dont want to use smart/auto ptr at all.
相关主题
Facebook’s New Face-Recognition Software Is Scary Good福利贴 how to write a winning resume (Part 1)
高手请指点C# equivalent of #ifdef _DEBUG
这是住一晚就能拿3万点吧 IHG AcceleratePh.D.(Computational Biology) in CS Department at Old Dominion University
进入Programming版参与讨论
a**a
发帖数: 416
11
完全赞同。本来想说两句的,看见有人已经说了,我就省得麻烦。

【在 r*******q 的大作中提到】
: 对于C++来说,一条就够了:不用"裸"的new。对内存以外的资源也适合。
: 只要做到了这一条,你一般来说是不会有内存泄漏问题的,内存溢出也基本上
: 不会发生,或者说一旦发生可以检测出来。
: 在积累一定代码后,在你的C++程序中应该是看不到new/delete和其它内存分配
: 函数的。而且你的C++程序和没有这些积累的代码几乎没有区别。更重要的是
: 你不需要老是记着去调用delete。你完全可以把delete忘了。你根本不需要什么
: 检测内存泄漏的软件,因为出现泄漏的概论几乎为0.
: C++提供了很多优秀的特性,但很多人却用得很垃圾...

N********n
发帖数: 8363
12
Purify

【在 t*****l 的大作中提到】
: 每次都是内存出问题,都不知道去哪里找,郁闷
u****u
发帖数: 229
13
关键是预防,而不是检查。

【在 a**a 的大作中提到】
: 完全赞同。本来想说两句的,看见有人已经说了,我就省得麻烦。
r*******q
发帖数: 50
14
You know nothing about what I'm saying...
There is NO smart/auto ptr in standard C++ at all.
And I completely disagree your statement.
At lease for memory leak, only constructor, destructor and operator overload
are needed. It can be adapt to ANY size of project. You NEVER need
to consder memory leak.

【在 c********e 的大作中提到】
: i take it like a joke.
: maybe it can be done, but for pretty much all mid and up scale project,
: none of them ended up like that. u always have to put extra brain to think
: about mems all the time. at least for realtime networking stuff, thats my
: feeling.
: I dont want to use smart/auto ptr at all.

r*******q
发帖数: 50
15
Please, think, then try. Don't expect others can give you
the details. If you can't get the solution from coarse
information, you are not a good programmer. You should
feel luck that you already have some coarse information.
I have to figure it out myself...
w********r
发帖数: 32
16
Smart Pointers and Naked Pointers:
http://www.developer.com/tech/print.php/10923_3491166_3

【在 r*******q 的大作中提到】
: Please, think, then try. Don't expect others can give you
: the details. If you can't get the solution from coarse
: information, you are not a good programmer. You should
: feel luck that you already have some coarse information.
: I have to figure it out myself...

r*******q
发帖数: 50
17
NEVER use such stupid "smart" thing. You ONLY need standard,
most simple C++ syntax!
It's M$'s style to introduce those "smart" things
and make everything messed up.
The so called "smart" pointer is something like COM.
But COM is the worst thing M$ introduced!
Anything need to call "Release()" is NOT the solution.
The only correct way should let you totaly FORGET
Release() or delete completely.

【在 w********r 的大作中提到】
: Smart Pointers and Naked Pointers:
: http://www.developer.com/tech/print.php/10923_3491166_3

q*c
发帖数: 9453
18
That is .NET.
But even .NET has tons of problem at release shared resources.
There is no magica bullet. Can not believe what you said.
can kindly give us a little example how to "completely eliminate"
leak? This can help too many people.

【在 r*******q 的大作中提到】
: NEVER use such stupid "smart" thing. You ONLY need standard,
: most simple C++ syntax!
: It's M$'s style to introduce those "smart" things
: and make everything messed up.
: The so called "smart" pointer is something like COM.
: But COM is the worst thing M$ introduced!
: Anything need to call "Release()" is NOT the solution.
: The only correct way should let you totaly FORGET
: Release() or delete completely.

f*****e
发帖数: 57
19

Totally agree. You have to know when to release the resources, don't you?
For a complicated system that you need to pass things around, some bookkeeping
have to be done.

【在 q*c 的大作中提到】
: That is .NET.
: But even .NET has tons of problem at release shared resources.
: There is no magica bullet. Can not believe what you said.
: can kindly give us a little example how to "completely eliminate"
: leak? This can help too many people.

c********e
发帖数: 383
20
wow, i might know nothing so please let me know something. some solid example
will be nice indeed.
btw auto_ptr is part of C++ for many many years already

【在 r*******q 的大作中提到】
: You know nothing about what I'm saying...
: There is NO smart/auto ptr in standard C++ at all.
: And I completely disagree your statement.
: At lease for memory leak, only constructor, destructor and operator overload
: are needed. It can be adapt to ANY size of project. You NEVER need
: to consder memory leak.

w********r
发帖数: 32
21

Read it through, no "release()" needed.
The smart ptr example shows how it can be done, do not take it literally.
Automatic resource management of course can be done. This is not rocket
science,
see Java. But it is at the cost of performance: for example, with overloaded
assignment operator a single ptr assignment instruction is now replaced with
several bookkeeping instructions, which means it is now several times slower.
If you can show me your clever way of achieving auto res mgmt with good

【在 r*******q 的大作中提到】
: NEVER use such stupid "smart" thing. You ONLY need standard,
: most simple C++ syntax!
: It's M$'s style to introduce those "smart" things
: and make everything messed up.
: The so called "smart" pointer is something like COM.
: But COM is the worst thing M$ introduced!
: Anything need to call "Release()" is NOT the solution.
: The only correct way should let you totaly FORGET
: Release() or delete completely.

N********n
发帖数: 8363
22

If there really exists a robust & efficient way of getting rid of
memory leak then no one would bother researching so much on garbage
collection. Before I see some detail explanation on how you do it,
I'd remain skeptical about what you said.

【在 r*******q 的大作中提到】
: Please, think, then try. Don't expect others can give you
: the details. If you can't get the solution from coarse
: information, you are not a good programmer. You should
: feel luck that you already have some coarse information.
: I have to figure it out myself...

1 (共1页)
进入Programming版参与讨论
相关主题
[bssd]Golang还不错C# equivalent of #ifdef _DEBUG
围棋与软件开发:Choose Backlog Items That Serve Two PurposePh.D.(Computational Biology) in CS Department at Old Dominion University
Facebook’s New Face-Recognition Software Is Scary Good你们认为OO思想十几年后会被淘汰么?
高手请指点c++问题
这是住一晚就能拿3万点吧 IHG AccelerateAngular放弃service直接用controller如何
福利贴 how to write a winning resume (Part 1)
相关话题的讨论汇总
话题: smart话题: release话题: c++话题: ptr话题: memory