dataset in a shared class

ofekhorizon

Member
Joined
Jan 3, 2006
Messages
5
Location
Israel
Programming Experience
5-10
Hi there,
I have a web site that I've built in VB.NET, that contains few large datasets of the content of the site.

I fill the dataset from the database at the home page (if it is empty!) and then keep it in a shared public class.

This way, it fills only once for all the users and I save time filling it again in every page and every time that a new user visits the site.

I have a problem/question though: I'm not sure where the public shared class "sits" and if it uses cash memory or... how exactly does it work???

I'm afraid that when it will contain too much data, it will use lots of memory and slow down the site.

My question are:
1. Where does the shared public class sits?
2. How often does it clear up? Is it there forever???

Hope someone can answer these question...

Thanx in advance,
Ofek Cohany.
 
You are obviously a bit confused with your terminology. There is no such thing as a Shared class. I assume you mean a Shared field or property of a Public class. Like any other reference type variable, your variable only refers to an object when you create an object. You can clean it up yourself whenever you like by Disposing it and assigning Nothing to the variable. Otherwise, the object will exist as long as the variable is in scope, which means until your application exits if the variable is Shared.
 
Thanx jmcilhinney,
Ofcourse, you are right. I ment a shared variable within a public class.

One (well, few) questions still remains:

Does the shared variable "sit" in the cash memory?
Can it slow down the whole web site significantly if it is a big dataset that I put in the shared var?
Is there a way to check the amount of memory it occupies?

Thanx, again!!!!
 
Back
Top