线程和内存消耗 [英] Thread and memory consumption

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

问题描述




当使用很多

线程时,有没有人遇到大量的RAM消耗?


如果是,我们怎样才能降低已用内存​​的水平?


非常感谢!

Marty

Hi,

Does anybody is experiencing a lot of RAM consumption when using many
threads ?

If yes, how can we reduce that level of used memory?

Thanks tou!
Marty

推荐答案

使用更少的线程?减少每个线程正在进行的分配数量?


这完全取决于线程使用的资源。据推测他们

不只是闲着;)

马蒂 < XM ****** @ hotmail.com>在消息中写道

news:txgqe.41479
Use less threads? Reduce the amount of allocations each thread is doing?

It all depends on what resources your threads are using. Presumably they
aren''t just idling ;)
"Marty" <xm******@hotmail.com> wrote in message
news:txgqe.41479


wr.27088@clgrps12 ...
wr.27088@clgrps12...

<当使用很多线程时,有没有人经历过大量的RAM消耗?

如果是,我们如何降低已用内存​​的水平呢?

谢谢你!
Marty
Hi,

Does anybody is experiencing a lot of RAM consumption when using many
threads ?

If yes, how can we reduce that level of used memory?

Thanks tou!
Marty



嗨罗宾,


我在一个对象中运行一个线程(命名为myQueue),为队列中的每个项目引发一个事件

。因此,它是一个清空

待处理消息队列的对象。

该对象myQueue用于接受最多50个服务器的服务器中/>
并发客户端连接,每个连接都有自己的myQueue。

每个客户端向服务器发送消息,消息在

客户端排队myQueue。


当线程完成队列中的
迭代后,该线程将休眠10毫秒。


这在ressources上非常低(它在每个线程中只使用一个队列)和

我想知道使用这样的线程是否是内存使用率高的原因。微软是否记录了单个

线程的消耗,只是闲置?如何在不查看任务的情况下对其进行量化

经理?


谢谢,

Marty

Robin Tucker写道:
Hi Robin,

I run a thread in an object (named myQueue) that raise an event for
every item within a queue. So it is an object that empty a queue of
pending messages.

That object, myQueue, is used in a server that accept up to 50
concurrent client connection, each connection having its own myQueue.
Each client sends messages to the server and message are queued in the
client''s myQueue.

The thread will sleep for 10 milliseconds when it finish an iteration of
its queue.

This is very low on ressources (it use only a queue in each thread) and
I was wondering if using such threads would be the reason for a high
memory usage. Does microsoft document the consumption of a single
thread, just idling? How could I quantify it without looking in the task
manager?

Thanks,
Marty

Robin Tucker wrote:
使用更少的线程?减少每个线程正在进行的分配量?

这完全取决于线程使用的资源。据推测,他们不只是闲着;)

Marty < XM ****** @ hotmail.com>在消息中写道
news:txgqe.41479
Use less threads? Reduce the amount of allocations each thread is doing?

It all depends on what resources your threads are using. Presumably they
aren''t just idling ;)
"Marty" <xm******@hotmail.com> wrote in message
news:txgqe.41479


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

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