.NET应用程序的合理内存量是多少? [英] What's a reasonable amount of memory for a .NET application?

查看:60
本文介绍了.NET应用程序的合理内存量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些抱怨,我们的一个托管应用正在使用20-25Mb的RAM.我通常会退缩说内存很便宜.克服它.

I've had a couple of complaints that one of our managed apps is using 20-25Mb of RAM. I normally push back and say that memory's cheap; get over it.

这对于Windows Forms应用程序合理吗?

Is this reasonable for a Windows Forms app?

推荐答案

20-25MB没什么.

20-25MB is nothing.

.Net框架并不总是总是立即回收RAM.随着时间的流逝,我发现应用程序在昂贵的"过程中会达到数百MB RAM的峰值,然后甚至在昂贵的"过程完成后就坐在那里.但是,这具有误导性.该应用未使用此RAM.只是垃圾收集器尚未发现需要收集大量旧RAM.如果操作系统需要该RAM,请放心,它将被收集.应用程序最多只能使用几百个K的想法仅在 managed 环境中不适用—对于操作系统进程,是的.对于本机应用程序,也许.但不是托管代码.否则,您最终只会获得具有完整GB或更多RAM的系统,而这些RAM只是处于空闲状态.

The .Net framework doesn't always recycle RAM right away anyway. Over time I've seen apps grow to peak at a few hundred MB of RAM during an "expensive" process, and then just sit there even after the "expensive" process finished. However, this is misleading. The app wasn't using this RAM. It's just that the garbage collector hasn't seen a need to collect a lot of old RAM yet. If the operating system had need of that RAM rest assured that it would be collected. The idea that an app should only use a few hundred K at most just doesn't apply in a managed environment — for operating system processes , yes. For native apps, maybe. But not managed code. Otherwise you just end up with systems that have a full GB or more of RAM that just sits idle.

这篇关于.NET应用程序的合理内存量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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