什么是内存泄漏 [英] What is memory leakage

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

问题描述

什么是内存泄漏,任何人都可以用示例代码解释

What is memory leakage, could any one explain with sample code

推荐答案

Ramasubbu Ramasubramanian XR(AS / EAB)写道:
Ramasubbu Ramasubramanian XR (AS/EAB) wrote:
什么是内存泄漏,任何人都可以用示例代码解释
What is memory leakage, could any one explain with sample code




当你的程序慢慢消耗系统内存时。


int main(无效)

{

char * pMembloc;


//永不免费() 。

for(;;)

{

pMemblock = malloc(1024);

}


返回0;

}



When your program slowly consumes system memory.

int main(void)
{
char *pMembloc;

// Never free().
for (;;)
{
pMemblock = malloc(1024);
}

return 0;
}


Mark Odell写道:
Mark Odell wrote:
Ramasubbu Ramasubramanian XR(AS / EAB)写道:
Ramasubbu Ramasubramanian XR (AS/EAB) wrote:
什么是内存泄漏,任何人都可以用示例代码解释
What is memory leakage, could any one explain with sample code



当你的程序慢慢消耗系统内存。

int main(void)
{char * pMembloc;

//永远不会自由()。
佛r(;;)
{
pMemblock = malloc(1024);


返回0;
}


When your program slowly consumes system memory.

int main(void)
{
char *pMembloc;

// Never free().
for (;;)
{
pMemblock = malloc(1024);
}

return 0;
}



稍微偏离主题,当一个程序终止时,它所分配的所有内存都将被分配给系统,对吗? (是的,我知道,系统

具体......)还是有很多系统不能这样做?


Slightly off-topic, when a program terminates, all the memory it had
allocated is returned to the system, right? (Yeah, I know, system
specific...) Or are there many systems that don''t do that?


Ramasubbu Ramasubramanian XR(AS / EAB)写道:
Ramasubbu Ramasubramanian XR (AS/EAB) wrote:
什么是内存泄漏,任何人都可以用示例代码解释
What is memory leakage, could any one explain with sample code




问比尔盖茨。直到大约8年前我才听说过这个词。
http://msdn.microsoft.com/library/de...emory_leak.asp


在应用程序级别,无法释放malloc分配的RAM,或者不进行垃圾回收,这是一回事。

比尔盖茨通过在操作系统中包含内存分配错误将其提升到一个新的水平本身和编程工具。


gtoomey



Ask Bill Gates. I hadn''t heard of the term until about 8 years ago.
http://msdn.microsoft.com/library/de...emory_leak.asp

At the application level, failing to free RAM allocated by malloc, or not going garbage collection, is one thing.
Bill Gates brought this to a new level by including memory allocation errors in the OS itself and in programming tools.

gtoomey


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

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