终端服务器的内存问题? [英] Memory issues with Terminal Server??

查看:68
本文介绍了终端服务器的内存问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在[MVP]的建议上交叉发布这个问题

我有一个.NET应用程序,我正在用C#开发我正在加载
从数据集中获取
信息,然后将数据集推送到网格,或者根据特定表单将其他控件转换为
。此应用程序设置为

,其中一个MDI父级调用MDI子级,但一个Modal

表单(报表查看器)除外。


当我运行应用程序并运行其中一个拉动数据集

信息的屏幕时,我在TaskManager中看到(我知道,我知道只是听我说)

内存从25MB增长到60-70 MB。如果我关闭这个屏幕(我正在调用所有

的dispose和close方法,我可以找到所有对象)

内存保持在相同的阈值,并且

之后在某些情况下爬得更高我称之为处置方法。


我明白GC可能在后台运行(或者会在某些情况下运行)

来释放这个内存,但是我观察并在这些新闻组中听到的内容

是GC将清理这些对象但是将内存分配给

应用程序。


这里的扭曲是这个应用程序将被部署到终端

服务器,并且可能有多达35个用户运行此应用程序。 35 * 70MB

= 2.45GB这对于其他应用程序没有留下太大的内存空间,所以我有点担心GC会如何处理这种情况。


当我在应用程序上运行应用程序分析器时,我发现即使在处理了

之后(也许我只是没有等待足够长的时间)就有了程序集

仍然为我已经关闭的表单加载(第三部分.NET控件)他们似乎

占用了相当多的空间。


所以我的总结问题就在这篇小说的描述之后。


1.)GC将如何在终端服务器中处理这种情况

环境,如果

应用程序关闭之前它没有将内存返回给操作系统对我来说可能是个问题。


2.)无论如何我可以卸载我看到的这些组件

我已经处理过表格了吗?


3.)任何使GC返回内存的方法操作系统


4.)其他人在终端

服务器上有自定义.net应用程序的经验,如果有,你学到了什么。

很抱歉这个冗长的问题,并感谢所有可以提供帮助的人!


贾斯汀


Cross posting this question on the recommendation of an [MVP]
I have a .NET application that I am developing in C# I am loading
information in from a dataset, and then pushing the dataset to a grid, or
other controls depending on the particular form. This application is setup
with one MDI parent calling MDI children with the exception of one Modal
form (the report viewer).

When I run the application and run one of the screens that pulls the dataset
information, I see in TaskManager (I know, I know just hear me out) the
memory grow from 25MB to 60-70 MB. If I close this screen (I am calling all
of the dispose and close methods I can find for all of my objects) the
memory remains at the same threshold, and in some cases climbs higher after
I call a dispose method.

I understand that the GC may be running in the background (or will at some)
to free this memory but what I observer and keep hearing in these newsgroups
is that the GC will clean these objects but leave the memory allocated to
the application.

The twist here is that this application will be deployed to a terminal
server and may have as many as 35 users running this application. 35 * 70MB
= 2.45GB this doesn''t leave much memory room for other applications, so I am
a bit concerned how GC will handle this situation.

When I run an application profiler on the application I see that even after
disposal (maybe I am just not waiting long enough) there are assemblies
still loaded for forms that I have closed (3rd part .NET controls) They seem
to be taking up quite a bit of room.

So my summary questions are here after this novel of a description.

1.) How will the GC handle this situation in the terminal server
environment, if it doesn''t return the memory to the OS before the
application is closed it could be a problem for me.

2.) Is there anyway that I can unload these assemblies that I see even after
I have disposed the form?

3.) Any way to make the GC return the memory to the OS

4.) Anyone else have an experience with Custom .net applications in terminal
server, and if so what have you learned.

Sorry for the lengthy question, and an advanced thanks to all who can help!

Justin

推荐答案



我认为您为此应用程序选择了错误的应用程序类型。

首先,如果有35个用户连接,您可以获得许可证到
同一台服务器?


我的建议是你要把它变成一个网络应用程序(非常时间

消费)或者创建客户端/服务器应用程序。

您可以使用Web服务从数据库中读取信息,并与在本地计算机上运行的win客户端进行交互

。你可以设计你的win

应用程序存储在网络共享中并从那里用于所有客户端,

只需要在客户机中保留任何本地信息。


但我会明确地改变你目前的结构。


欢呼,


-

Ignacio Machin,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局


" Justin Lazanowski" <菊**** @ nospam.southeastmilk.org>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi,
I think that you selected the wrong application type for this application.
First of all how may licences do you have for having 35 users connected to
the same server?

My advise is that either you transform this to a web app ( very time
consuming ) or to create a client/server app.
You could have a web service reading the info from the db and interacting
with win clients running on the local machines. you could design your win
app to be stored in a network share and used from there for all the clients,
just need to keep any local information in the client machines.

But I would definely change your current strcuture.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Justin Lazanowski" <ju****@nospam.southeastmilk.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

在[MVP]的建议上交叉发布这个问题

我有一个我在C#中开发的.NET应用程序我从数据集中加载信息,然后推送数据集到网格,或
其他控件取决于特定的形式。此应用程序设置
,一个MDI父级调用MDI子级,但一个Modal
表单(报表查看器)除外。

当我运行应用程序并运行其中一个拉出数据集信息的屏幕,我在TaskManager中看到(我知道,我知道只是听到了
)内存从25MB增长到60-70 MB。如果我关闭这个屏幕(我正在调用我可以为所有
对象调用的所有处理和关闭方法),则内存保持在相同的阈值,并且在某些情况下会爬升在我调用一个处理方法之后更高。

我知道GC可能在后台运行(或者会在某些情况下运行)以释放这些内存,但我观察并在这些内容中听到
新闻组是GC将清理这些对象但是将内存分配给应用程序。

这里的扭曲是这个应用程序将被部署到终端
服务器,可能有多达35个用户运行此应用程序。 35 *
70MB = 2.45GB这并没有为其他应用留下太多的存储空间,
所以我有点担心GC会如何处理这种情况。

当我在应用程序上运行一个应用程序分析器我看到甚至在处理之后(也许我只是不等待足够长的时间)仍然会为我关闭的表单加载
程序集(第三部分.NET 控件)他们似乎占用了相当多的空间。

所以我的总结问题就在这篇小说的描述之后。

1.)如何GC在终端服务器环境中处理这种情况,如果在
应用程序关闭之前它没有将内存返回给操作系统,那对我来说可能是一个问题。
2.)在我处理完表格之后,无论如何我可以卸载这些我看到的组件吗?

3.)任何使GC返回内存的方法操作系统

4.)其他人都有使用Custom .net应用程序的经验在终端服务器上,如果有的话,你学到了什么。

抱歉这个冗长的问题,并感谢所有能帮助的人!
< br>贾斯汀

Cross posting this question on the recommendation of an [MVP]
I have a .NET application that I am developing in C# I am loading
information in from a dataset, and then pushing the dataset to a grid, or
other controls depending on the particular form. This application is setup
with one MDI parent calling MDI children with the exception of one Modal
form (the report viewer).

When I run the application and run one of the screens that pulls the
dataset information, I see in TaskManager (I know, I know just hear me
out) the memory grow from 25MB to 60-70 MB. If I close this screen (I am
calling all of the dispose and close methods I can find for all of my
objects) the memory remains at the same threshold, and in some cases
climbs higher after I call a dispose method.

I understand that the GC may be running in the background (or will at
some) to free this memory but what I observer and keep hearing in these
newsgroups is that the GC will clean these objects but leave the memory
allocated to the application.

The twist here is that this application will be deployed to a terminal
server and may have as many as 35 users running this application. 35 *
70MB = 2.45GB this doesn''t leave much memory room for other applications,
so I am a bit concerned how GC will handle this situation.

When I run an application profiler on the application I see that even
after disposal (maybe I am just not waiting long enough) there are
assemblies still loaded for forms that I have closed (3rd part .NET
controls) They seem to be taking up quite a bit of room.

So my summary questions are here after this novel of a description.

1.) How will the GC handle this situation in the terminal server
environment, if it doesn''t return the memory to the OS before the
application is closed it could be a problem for me.

2.) Is there anyway that I can unload these assemblies that I see even
after I have disposed the form?

3.) Any way to make the GC return the memory to the OS

4.) Anyone else have an experience with Custom .net applications in
terminal server, and if so what have you learned.

Sorry for the lengthy question, and an advanced thanks to all who can
help!

Justin





" Justin Lazanowski" <菊**** @ nospam.southeastmilk.org>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...

"Justin Lazanowski" <ju****@nospam.southeastmilk.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

在[MVP]的建议上交叉发布这个问题

我有一个我在C#中开发的.NET应用程序我从数据集中加载信息,然后推送数据集到网格,或
其他控件取决于特定的形式。此应用程序设置
,一个MDI父级调用MDI子级,但一个Modal
表单(报表查看器)除外。

当我运行应用程序并运行其中一个拉出数据集信息的屏幕,我在TaskManager中看到(我知道,我知道只是听到了
)内存从25MB增长到60-70 MB。如果我关闭这个屏幕(我正在调用我可以为所有
对象调用的所有处理和关闭方法),则内存保持在相同的阈值,并且在某些情况下会爬升在我调用一个处理方法之后更高。

我知道GC可能在后台运行(或者会在某些情况下运行)以释放这些内存,但我观察并在这些内容中听到
新闻组是GC将清理这些对象但是将内存分配给应用程序。

这里的扭曲是这个应用程序将被部署到终端
服务器,可能有多达35个用户运行此应用程序。 35 *
70MB = 2.45GB这并没有为其他应用留下太多的存储空间,
所以我有点担心GC会如何处理这种情况。

当我在应用程序上运行一个应用程序分析器我看到甚至在处理之后(也许我只是不等待足够长的时间)仍然会为我关闭的表单加载
程序集(第三部分.NET 控件)他们似乎占用了相当多的空间。

所以我的总结问题就在这篇小说的描述之后。

1.)如何GC在终端服务器环境中处理这种情况,如果在
应用程序关闭之前它没有将内存返回给操作系统,那对我来说可能是一个问题。
2.)在我处理完表格之后,无论如何我可以卸载这些我看到的组件吗?

3.)任何使GC返回内存的方法操作系统

4.)其他人都有使用Custom .net应用程序的经验在终端服务器上,如果有的话,你学到了什么。

抱歉这个冗长的问题,并感谢所有能帮助的人!

贾斯汀

Cross posting this question on the recommendation of an [MVP]
I have a .NET application that I am developing in C# I am loading
information in from a dataset, and then pushing the dataset to a grid, or
other controls depending on the particular form. This application is setup
with one MDI parent calling MDI children with the exception of one Modal
form (the report viewer).

When I run the application and run one of the screens that pulls the
dataset information, I see in TaskManager (I know, I know just hear me
out) the memory grow from 25MB to 60-70 MB. If I close this screen (I am
calling all of the dispose and close methods I can find for all of my
objects) the memory remains at the same threshold, and in some cases
climbs higher after I call a dispose method.

I understand that the GC may be running in the background (or will at
some) to free this memory but what I observer and keep hearing in these
newsgroups is that the GC will clean these objects but leave the memory
allocated to the application.

The twist here is that this application will be deployed to a terminal
server and may have as many as 35 users running this application. 35 *
70MB = 2.45GB this doesn''t leave much memory room for other applications,
so I am a bit concerned how GC will handle this situation.

When I run an application profiler on the application I see that even
after disposal (maybe I am just not waiting long enough) there are
assemblies still loaded for forms that I have closed (3rd part .NET
controls) They seem to be taking up quite a bit of room.

So my summary questions are here after this novel of a description.

1.) How will the GC handle this situation in the terminal server
environment, if it doesn''t return the memory to the OS before the
application is closed it could be a problem for me.

2.) Is there anyway that I can unload these assemblies that I see even
after I have disposed the form?

3.) Any way to make the GC return the memory to the OS

4.) Anyone else have an experience with Custom .net applications in
terminal server, and if so what have you learned.

Sorry for the lengthy question, and an advanced thanks to all who can
help!

Justin




首先,得出结论,35个实例将消耗35倍的工作量

设置(如果这样你在taskman中看到的是不正确的。

工作集包括一个共享部分,即在进程之间共享的内存
。另一方面,JITted代码是不可共享的,这可能是在TS场景中的问题,但是这个应用程序消耗的大部分WS页面是b $ b。主要是由于从GC堆中分配的对象,这是在OO

(和托管)世界设计时必须付出的代价。


回答你的问题。

Q1。 GC与此无关,当它需要内存用于页面时,操作系统将回收内存,并且进程将页面返回到操作系统或

页面文件当他们的WS被操作系统修剪时,这很糟糕

表现明智。

Q2。程序集卸载与Disposing Forms或其他任何内容无关,
卸载appdomain时卸载
程序集。您的应用程序使用其他AppDomain的可能性非常小?

,对吧?
Q3。没有。没有必要,这是由OS和

CLR处理的。当存在内存压力时,CLR将修剪它的WS,因此它将向系统返回VAS段(如果可能的话)。

Q4。是的,我所学到的是要关注内存资源

消费(在开发非托管的时候还需要做的事情)需要在TS上运行的
应用程序,但是在一个较小的范围内。

选择容器时要小心,例如,如果可能的话,尽可能使用具有固定大小的
数组。尽可能晚地创建

您的对象并释放您的对象并尽可能早地调用Dispose as

,但不要自己调用GC.Collect()。配置您的

应用程序,查找可能保存的容器中缓存的引用

在必要时保持更长时间。

创建时要小心额外的(过多的)线程,每个线程

预留1MB的连续虚拟地址空间,保持计数低至

可能。

小心使用Interop(COM或本机代码),在

TS场景中尽可能不使用它。

如果您的代码库很大,请尝试NGEN您的程序集,NGEN 'd assembly

可以分享他们的代码,但是再次不要期望太多,JIted代码

通常相当紧凑,因为并非所有的方法都是加载的模块是

必须编译。

我注意到,精心设计的应用程序需要~10%-20%

更多在TS场景中,你的里程可能会有所不同。


Willy。




First of, to conclude that 35 instances will consume 35 times the working
set (if this is what you are looking at in taskman) is not correct.
The working set includes a shared part, that is memory that is shared
between process. On the other hand JITted code is non sharable which
is/might (be) a problem in TS scenarios, but the bulk of the WS pages
consumed by this application are mostly due to the objects allocated from
the GC heap, and that''s the price you have to pay when designing in a OO
(and managed) world.

To answer your Q.
Q1. The GC has nothing to do with this, the OS will reclaim memory when it
needs memory for pages and the processes will return pages to the OS or to
the paging file when their WS are getting trimmed by the OS, which is bad
performance wise.
Q2. Assembly unloading has nothing to do with Disposing Forms or whatever,
assemblies are unloaded when the appdomain is unloaded. It''s very unlikely
that your application uses additional AppDomains, right?
Q3. No. And there is no need to, this is taken care of by the OS and the
CLR. The CLR will trim it''s WS when there is memory pressure, so it will
return VAS segments to the system (when possible).
Q4. Yep, what I have learned is to pay attention to the memory resource
consumption (something you also need to do when developping unmanaged
applications that have to run on TS, but to a lesser extend) .
Be careful when selecting your containers, as an example, prefer using
arrays with fixed sizes when possible over ArrayList when possible. Create
your objects as late as possible and free your objects and call Dispose as
early as possible, but don''t call GC.Collect() yourself. Profile your
application, look for references cached in containers that might be kept
alive for a longer period as necessary.
Be careful when creating additional (excessive) threads , each thread
reserves 1MB of contiguous virtual address space, keep the count as low as
possible.
Be careful with Interop (COM or native code), don''t use it when possible in
TS scenarios.
If your code base is large try to NGEN your assemblies, NGEN''d assemblies
can share their code, but again don''t expect too much from this, JIted code
is in general rather compact as not all methods of a loaded modules are
necessarily compiled.
What I''ve noticed is that a carefully designed application needs ~10%-20%
more memory in TS scenarios, your mileage may vary of course.

Willy.



也许我不喜欢没有正确的定义,但我认为这是一个客户端服务器

应用程序。


Windows应用程序 - 客户端

SQL服务器数据库 - 服务器


我们目前的环境在已发布的Citrix上运行90%的用户

桌面我们被授权在终端服务上运行这些用户。



Ignacio Machin(.NET / C#MVP)" < ignacio.machin AT dot.state.fl.us>在消息新闻中写了

:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Maybe I don''t have the right definitions but I think this is a client server
application.

Windows Application - Client
SQL Server Database - Server

Our current enviroment here runs 90% of our users on Published Citrix
Desktops we are licenced to run these users on terminal services.


"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP10.phx.gbl...


我认为您为此应用程序选择了错误的应用程序类型。
首先,如果有35个用户连接到同一台服务器,您可以获得许可证吗? />
我建议您将其转换为Web应用程序(非常耗时)或创建客户端/服务器应用程序。
您可以使用Web服务从数据库并与在本地计算机上运行的win客户端进行交互。您可以设计您的win
应用程序存储在网络共享中并从那里用于所有客户端,只需要在客户端计算机中保留任何本地信息。

但我会明确地改变你目前的结构。

欢呼,

- Ignacio Machin,
ignacio.machin at dot.state.fl。我们
佛罗里达州交通局

Justin Lazanowski <菊**** @ nospam.southeastmilk.org>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi,
I think that you selected the wrong application type for this application.
First of all how may licences do you have for having 35 users connected to
the same server?

My advise is that either you transform this to a web app ( very time
consuming ) or to create a client/server app.
You could have a web service reading the info from the db and interacting
with win clients running on the local machines. you could design your win
app to be stored in a network share and used from there for all the
clients, just need to keep any local information in the client machines.

But I would definely change your current strcuture.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Justin Lazanowski" <ju****@nospam.southeastmilk.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

交叉发布关于[MVP]的建议这个问题

我有一个我在C#中开发的.NET应用程序我从数据集中加载信息,然后将数据集推送到网格,或
其他控件取决于特定的形式。此应用程序设置为一个MDI父级调用MDI子级,但一个
模式窗体(报表查看器)除外。

当我运行应用程序并运行其中一个拉出数据集信息的屏幕,我在TaskManager中看到(我知道,我知道只是听到了
)内存从25MB增长到60-70 MB。如果我关闭这个屏幕(我正在调用我可以为所有
对象调用的所有处理和关闭方法),则内存保持在相同的阈值,并且在某些情况下会爬升在我调用一个处理方法之后更高。

我知道GC可能在后台运行(或者会在某些情况下运行)以释放这些内存,但我观察并在这些内容中听到
新闻组是GC将清理这些对象但是将内存分配给应用程序。

这里的扭曲是这个应用程序将被部署到终端
服务器,可能有多达35个用户运行此应用程序。 35 *
70MB = 2.45GB这并没有为其他应用留下太多的存储空间,
所以我有点担心GC会如何处理这种情况。

当我在应用程序上运行一个应用程序分析器我看到甚至在处理之后(也许我只是不等待足够长的时间)仍然会为我关闭的表单加载
程序集(第三部分.NET 控件)他们似乎占用了相当多的空间。

所以我的总结问题就在这篇小说的描述之后。

1.)如何GC在终端服务器环境中处理这种情况,如果在
应用程序关闭之前它没有将内存返回给操作系统,那对我来说可能是一个问题。
2.)在我处理完表格之后,无论如何我可以卸载这些我看到的组件吗?

3.)任何使GC返回内存的方法操作系统

4.)其他人都有使用Custom .net应用程序的经验在终端服务器上,如果有的话,你学到了什么。

抱歉这个冗长的问题,并感谢所有能帮助的人!
< br>贾斯汀

Cross posting this question on the recommendation of an [MVP]
I have a .NET application that I am developing in C# I am loading
information in from a dataset, and then pushing the dataset to a grid, or
other controls depending on the particular form. This application is
setup with one MDI parent calling MDI children with the exception of one
Modal form (the report viewer).

When I run the application and run one of the screens that pulls the
dataset information, I see in TaskManager (I know, I know just hear me
out) the memory grow from 25MB to 60-70 MB. If I close this screen (I am
calling all of the dispose and close methods I can find for all of my
objects) the memory remains at the same threshold, and in some cases
climbs higher after I call a dispose method.

I understand that the GC may be running in the background (or will at
some) to free this memory but what I observer and keep hearing in these
newsgroups is that the GC will clean these objects but leave the memory
allocated to the application.

The twist here is that this application will be deployed to a terminal
server and may have as many as 35 users running this application. 35 *
70MB = 2.45GB this doesn''t leave much memory room for other applications,
so I am a bit concerned how GC will handle this situation.

When I run an application profiler on the application I see that even
after disposal (maybe I am just not waiting long enough) there are
assemblies still loaded for forms that I have closed (3rd part .NET
controls) They seem to be taking up quite a bit of room.

So my summary questions are here after this novel of a description.

1.) How will the GC handle this situation in the terminal server
environment, if it doesn''t return the memory to the OS before the
application is closed it could be a problem for me.

2.) Is there anyway that I can unload these assemblies that I see even
after I have disposed the form?

3.) Any way to make the GC return the memory to the OS

4.) Anyone else have an experience with Custom .net applications in
terminal server, and if so what have you learned.

Sorry for the lengthy question, and an advanced thanks to all who can
help!

Justin




这篇关于终端服务器的内存问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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