Hi,
In our application static class variables are created when application is invoked by a user and these variables are accessed throughout the application, once the user shutdown application dose it get cleared from the memory by GC
Note: Application refers to Web application developed using asp.net and c#.net.

VulpesPosted Aug 21, 2014, 11:54 AM
I'd repost the question to a new thread.
Karthik PuppalaPosted Aug 21, 2014, 8:08 AM
As per our application build so far it is required to hold the large amount of data on server side and need to wait for end user approval to transfer data to data base, not only this as well as to bind the data to gridview on page change or filtering data displayed on grid i need to hold the data
Please let me know what can improve site performance, and reduce the number of data base hits per user.
Note: Our application is very huge and my self involved in development of this application since past 4 year's and thousands of end users are using this application on this date.
Please suggest.
VulpesPosted Aug 20, 2014, 7:11 PM
Karthik PuppalaPosted Aug 20, 2014, 8:09 AM
weather the static variables are initialized at page level, dose they get destroyed when page is not in use(like view state)
My idea behind this to use static variables instead of view state's to hold huge amount of data like DataSet in ADO.net
Please suggest.
VulpesPosted Jul 21, 2014, 10:40 AM
Consequently, any static fields which still refer to objects when a .NET application ends will automatically have their memory reclaimed.
Posted Jul 21, 2014, 10:19 AM
Static methods are not objects that are subject to garbage collection, so
they have no lifetime issues for you to deal with.
For each static field there is one copy per-appdomain - each appdomain can
have a different value. The static variable itself is not garbage
collected - it is just a memory location that contains a reference to an
object. Static fields are considered to be GC roots, so any references in
them will not be garbage collected as long as the field contains that
reference. If you change the field to point to a new reference or set the
field value to null then the object whose reference was stored there becomes
eligible for collection.
Static class constructors will run once for each appdomain they get loaded
in.
Per your example, the method AddItem() is not an object that can get
garbage collected, it is a method. Each time you call AddItem a new
Collection object will be allocated and its reference assigned to the field
coll. Any previous reference stored in that field will be eligible for
garbage collection, but the current reference will not be GCd.
Kindly mark as answer, if it helps you
Regards,
Kailash