这个自动垃圾收集器有什么用? [英] What good is this automatic garbage collector?

查看:73
本文介绍了这个自动垃圾收集器有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的.NET应用程序,带有两个或三个listViews,其中有b / b
填充图标,当用户点击正确的项目时,它们会显示

相关图片。我用image = null; "对于所有已经使用过的图像,将被关闭。这是如何无法减少内存消耗的原因。我注意到,使用任务管理器,垃圾

收集器实际上并没有进行任何收集,除非计算机内存不足b
。这是非常愚蠢的,有什么好处的垃圾收集器

当它们不再需要时它们不会收集被处理的物品?


此外,通常会避免调用CG.Collect()来提高性能和速度。

我还能做什么?


PS:我不会伤害你阅读这:
http://www.cs.tut。 fi / ~warp / MicrosoftComparingLanguages /

解决方案

>我注意到,使用任务管理器,垃圾< blockquote class =post_quotes>收藏家实际上并没有做任何收藏,除非计算机内存不足。这是非常愚蠢的,有什么好处的垃圾收集器
当它们不再需要时它们不会收集被处理的物品?



尽管如此,任务经理并不是检查的好工具。


我很好奇,这是多么愚蠢,每次使用处理器都会花费时间。

要使用一个方法你是否清空了你的垃圾桶,每次你扔了什么?b $ ba纸或其他什么?


Cor


您是否尝试过调用Dispose?


虽然垃圾收集器的意思是没有如果你对它没有用处,需要回收

内存,值得记住的是它在管理世界中有它的b
或关闭方法应该

仍然允许立即回收非托管内存...


请告诉我们...


Patrice


- -


" joe" <乔***** @ rot.ofm.net> écritdansle message de

news:uE **************** @ TK2MSFTNGP14.phx.gbl ...

我有一个简单的.NET应用程序,有两个或三个listViews,它们充满了图标,当用户点击正确的项目时,它们会显示相关的图像。我用image = null; "对于已经使用并将要关闭的所有图像。这是如何无法减少内存消耗的方法。我注意到,使用任务管理器,除非计算机内存不足,否则垃圾收集器实际上并没有进行任何收集。这是非常愚蠢的,有什么好处的垃圾收集器
当它们不再需要
时它们不收集被处理的物品?
此外,调用CG.Collect()通常可以避免性能和
速度。我还能做些什么?

PS:我不会伤到你读这个:
http://www.cs.tut.fi/~warp/MicrosoftComparingLanguages/



>使用方法你是否清空垃圾桶,每次你在纸上或其他什么时间抛出




你能回收吗?用编程语言处理对象?如果可以,那么

为什么要把它们放在回收站里?

只是好奇。


I have a simple .NET application with two or three listViews which are
filled with icons and when the user click on the proper item, they display
the related images. I use "image = null ; " for all images that have been
used and are going to be closed. This is how ever no way to reduce the
memory consumption. I have noticed , using the task manager, that garbage
collector doesn''t actually do any collections unless the computer becomes
low on memory. This is very foolish, and what good is a garbage collector
which doesn''t collect the disposed objects when they aren''t needed anymore?

Besides, calling CG.Collect() is usually avoided for performance and speed.
What else can i do?

PS: i wont hurt you to read this:
http://www.cs.tut.fi/~warp/MicrosoftComparingLanguages/

解决方案

>I have noticed , using the task manager, that garbage

collector doesn''t actually do any collections unless the computer becomes
low on memory. This is very foolish, and what good is a garbage collector
which doesn''t collect the disposed objects when they aren''t needed
anymore?


Allthough it the task manager is not the good instrument to check.

I am curious, what is foolish about this, every garbaging uses processor
time.

To use a methpore "Do you empty your trash bin, everytime you have thrown in
a paper or whatever?

Cor


Have you tried to call Dispose ?

Though the point of a garbage collector is that there is no need to reclaim
memory if you have no use for it, it''s worth to keep in mind that it have
its root in the managed world and that the Dispose or Close methods should
still allows to reclaim unmanaged memory immediately...

Please let us know...

Patrice

--

"joe" <jo*****@rot.ofm.net> a écrit dans le message de
news:uE****************@TK2MSFTNGP14.phx.gbl...

I have a simple .NET application with two or three listViews which are
filled with icons and when the user click on the proper item, they display
the related images. I use "image = null ; " for all images that have been
used and are going to be closed. This is how ever no way to reduce the
memory consumption. I have noticed , using the task manager, that garbage
collector doesn''t actually do any collections unless the computer becomes
low on memory. This is very foolish, and what good is a garbage collector
which doesn''t collect the disposed objects when they aren''t needed anymore?
Besides, calling CG.Collect() is usually avoided for performance and speed. What else can i do?

PS: i wont hurt you to read this:
http://www.cs.tut.fi/~warp/MicrosoftComparingLanguages/



> To use a methpore "Do you empty your trash bin, everytime you have thrown

in a paper or whatever?



Can you recycle disposed objects in a programming language? If you can, then
why do you put them in the recycle bin?
just curious.


这篇关于这个自动垃圾收集器有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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