内存不释放(来自收藏) [英] Memory doesn't release (from collections)

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

问题描述

您好,我正在使用多个队列集来存储一些数据(大约20,000个/ b $ b条目分为两个集合)。当我在Windows

任务管理器中查看进程时,我可以看到当收集开始时内存增加

fill。但是,当我停止线程并清除队列(并将

实例设置为空)时,内存根本不会丢失。


我在做什么有什么不对吗?


谢谢!

Hello, I am using several queue collections to store some data (about 20,000
entries split across 2 collections). When I view the process in the Windows
task manager I can see the memory increasing when the collections start to
fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!

推荐答案

仅仅因为一个对象有资格进行垃圾收集,所以没有是的意思是

立即收集垃圾。


当垃圾收集器决定运行时,任何符合条件的东西都会得到

收集。在那之前,它会坐在那里占用记忆。


Brian Mitchell <马******** @ hotmail.com>在留言中写道

新闻:我们************** @ TK2MSFTNGP12.phx.gbl ...
Just because an object is eligible for garbage collection, doesn''t mean it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:us**************@TK2MSFTNGP12.phx.gbl...
您好,我正在使用几个队列集合来存储一些数据(大约
20,000个条目分为两个集合)。当我在
Windows任务管理器中查看进程时,我可以看到当集合开始填充时内存增加。但是,当我停止线程并清除队列(并将
实例设置为空)时,内存根本不会丢失。

我做错了什么?
<谢谢!!
Hello, I am using several queue collections to store some data (about 20,000 entries split across 2 collections). When I view the process in the Windows task manager I can see the memory increasing when the collections start to
fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!



有没有办法强迫垃圾收集?


" Marina" <所以***** @ nospam.com>在消息中写道

新闻:uC ************** @ TK2MSFTNGP09.phx.gbl ...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
仅仅因为一个对象是有资格进行垃圾收集,并不意味着它会立即收集垃圾。

当垃圾收集器决定运行时,那么任何符合条件的垃圾都将被收集。在那之前,它会坐在那里占用记忆。

Brian Mitchell <马******** @ hotmail.com>在消息中写道
新闻:我们************** @ TK2MSFTNGP12.phx.gbl ...
Just because an object is eligible for garbage collection, doesn''t mean it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:us**************@TK2MSFTNGP12.phx.gbl...
您好,我正在使用几个队列集合来存储一些数据(关于
Hello, I am using several queue collections to store some data (about


20,000


20,000

分为2个集合的条目)。当我在
entries split across 2 collections). When I view the process in the


Windows


Windows

任务管理器中查看该过程时,我可以看到当集合开始填充
时内存会增加。但是,当我停止线程并清除队列(并将
实例设置为空)时,内存根本不会丢失。

我做错了什么?
<谢谢!!
task manager I can see the memory increasing when the collections start to fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!




是的,你可以使用gc.collect但不管我让程序坐了2个小时

它仍然没有释放内存。我甚至设置了一个断点来确保

该课程被设置为空。


Dave <戴夫(delete_this)@ miraclecatDELETETHISTOO.com>在留言中写道

新闻:u8 ************** @ TK2MSFTNGP10.phx.gbl ...
Yes, you can use gc.collect but no matter I let the program sit for 2 hours
and it still didn''t free the memory. I even set a breakpoint to make sure
the class was set to nothing.

"Dave" <dave(delete_this)@miraclecatDELETETHISTOO.com> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
有没有办法"力"垃圾收集?

码头 <所以***** @ nospam.com>在消息中写道
新闻:uC ************** @ TK2MSFTNGP09.phx.gbl ...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
仅仅因为一个对象有资格进行垃圾回收,并不是说
它立即收集垃圾。

当垃圾收集器决定运行时,那么符合条件的任何东西都将获得
集。在那之前,它会坐在那里占用记忆。

Brian Mitchell <马******** @ hotmail.com>在消息中写道
新闻:我们************** @ TK2MSFTNGP12.phx.gbl ...
Just because an object is eligible for garbage collection, doesn''t mean
it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will
get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:us**************@TK2MSFTNGP12.phx.gbl...
>您好,我正在使用多个队列集来存储一些数据(关于
> Hello, I am using several queue collections to store some data (about


20,000


20,000

>条目分为两个集合)。当我在
> entries split across 2 collections). When I view the process in the

中查看该过程时,
Windows


Windows

>任务管理器我可以看到当集合开始时内存增加>填。但是,当我停止线程并清除队列(并将
>实例设置为空)时,内存根本不会丢失。
>
>我做错了吗?
>
>谢谢!!
>
>
> task manager I can see the memory increasing when the collections start to > fill. However, when I stop the thread and clear the queues (and set the
> instance to nothing) the memory does not drop at all.
>
> Am I doing something wrong?
>
> Thanks!!
>
>





这篇关于内存不释放(来自收藏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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