.net c#何时放置静态数据表存储器

When does a static data table memory is disposed
2021-03-07
  •  译文(汉语)
  •  原文(英语)

我有一个方法可以返回超过1,00,000条记录,并且已经将它们存储在静态数据表中,并且此数据表绑定到分页的网格视图.

此静态数据表存储在哪里以及何时处置.

我的应用程序驻留在iis 7.5服务器上

速聊1:
这样的静态数据会在应用程序运行期间一直存在,或者直到您手动释放它为止.
速聊2:
我的应用程序是基于会话的应用程序,内存将一直驻留在服务器上,直到此会话处于活动状态;否则它将驻留在服务器上,直到重新启动应用程序池
速聊3:
静态数据跨会话保留.因此,直到重新启动应用程序池.
解决过程1

它存储在AppDomain上,并在卸载您的appdomain时进行处理.

解决过程2
  • 静态变量存储在IIS工作进程内存中.
  • 只要引用它们,它们就不会被丢弃.
  • 当工作进程回收或Web应用停止时,它们将消失.
  • 静态数据跨会话保留.

I have a method which will return me more than 1,00,000 records and I had stored them in a static data table, and this data table is bound to grid view which is paginated.

where is this static data table stored and when is it disposed.

My app is residing on iis 7.5 server

Talk1:
Static data like this stays around for as long as the application is running, or until you free it manually.
Talk2:
My application is a session based application will the memory reside on server until this session is active or it will reside on server until the app pool is restarted
Talk3:
Static data stays across sessions. So until app pool is restarted.
Solutions1

It's stored on the AppDomain and is disposed when your appdomain is unloaded.

Solutions2
  • Static variables are stored in the IIS Worker Process memory.
  • As long as they are referenced, they'll not be disposed.
  • And they'll be gone when the worker process recycles or when the web app is stopped.
  • Static data stays across sessions.
转载于:https://stackoverflow.com/questions/23003668/when-does-a-static-data-table-memory-is-disposed

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入