内存泄漏 [英] memory leakage

查看:87
本文介绍了内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在什么情况下内存泄漏更加幸福和什么

是解决内存泄漏问题的解决方案。

i want to know that on what situation memory leakage happan and what
is the solution to solve the problem of memory leakage.

推荐答案

2月20日晚上7:30,madhawi < madhaw ... @ gmail.comwrote:
On Feb 20, 7:30 pm, "madhawi" <madhaw...@gmail.comwrote:

i想知道在什么情况下内存泄漏开心了
i want to know that on what situation memory leakage happan



当你对malloc()和calloc()的调用多于你对
free()的调用时。

When you have more calls to malloc() and calloc() than you do to
free().


和什么

是解决内存泄漏问题的解决方案。
and what
is the solution to solve the problem of memory leakage.



每次调用calloc()或malloc()时都要调用free(),这对你的程序来说是



如果你想修复一些破损的东西,请看这里:
https://buildsecurityin.us-cert.gov/...oding/311.html


我正在处理一个大型项目。我用free()作为记忆。但是

我仍​​然遇到问题。当我从哪里删除线路时,我得到内存泄漏,然后我得到另一个问题,丢失信息。

user923005写道:
i m working on a large project. and i used free() for memory. but
still i get problem. when i removed the line from where i m getting
memory leakage, then i get another problem, loss of information.
user923005 wrote:

2月20日晚上7:30,madhawi < madhaw ... @ gmail.comwrote:
On Feb 20, 7:30 pm, "madhawi" <madhaw...@gmail.comwrote:

i想知道在什么情况下内存泄漏开心了
i want to know that on what situation memory leakage happan



当你对malloc()和calloc()的调用多于你对
free()的调用时。


When you have more calls to malloc() and calloc() than you do to
free().


和什么

是解决内存泄漏问题的解决方案。
and what
is the solution to solve the problem of memory leakage.



每次调用calloc()或malloc()时都要调用free(),这对你的程序来说是



如果你想修复一些破损的东西,请看这里:
https://buildsecurityin.us-cert.gov/...oding/311.html


2月21日上午8:30,madhawi < madhaw ... @ gmail.comwrote:
On Feb 21, 8:30 am, "madhawi" <madhaw...@gmail.comwrote:

i想知道什么情况下内存泄漏更好,什么是
i want to know that on what situation memory leakage happan and what



<转发给comp.programming>


你分配一些内存,

你使用那些内存,

现在你不想要记忆 - 你已经完成了(你应该释放

内存)


你忘了释放内存并继续前进,现在你不能回来

来释放记忆。


i认为这叫做泄密(我可能需要更正确但是这是

我想到了什么基础知识,)

http://en.wikipedia.org/wiki/Memory_leak
http://www.valgrind.org/docs/manual/...-start.prepare

<forwarded to comp.programming>

you allocate some memory,
you use those memory,
now you dont want the memory --you have done(and you should free the
memory)

you forgot to free the memory and go ahead, and now you cant come back
to free the memory.

i think this is called leak (I may need to more correct but this is
what basics come to my mind,)

http://en.wikipedia.org/wiki/Memory_leak
http://www.valgrind.org/docs/manual/...-start.prepare


是解决内存泄漏问题的解决方案。
is the solution to solve the problem of memory leakage.



是的,它是可以解决的,

1.良好的编程习惯,

2.好的工具集(适用于linux valgrind / memprof相当不错,)


--Raxit

yes, it is solvable,
1. Good Programming habits,
2. Good Toolset (for linux valgrind/memprof is reasonably good,)

--Raxit


这篇关于内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆