Set object = Nothing?

Results 1 to 4 of 4

Thread: Set object = Nothing?

  1. #1
    Cuong NG Guest

    Default Set object = Nothing?

    Hi,<BR><BR>If I set ojb = Session("blah").Execute(SQL)<BR><BR>should I set :<BR><BR>Set ojb = Nothing<BR><BR>?<BR><BR>The session("blah") is defined in the global.asa to connect to a database

  2. #2
    Rokea Guest

    Default RE: Set object = Nothing?

    It&#039s not a very good Idea to store a lot of data or objets in the session variables.. mostly because of the timeout, but anyway..<BR><BR>It&#039s always a good thing to put an pbjet that you&#039ve set to nothing once your finished with it, so that the server can get back his ressources faster.<BR><BR>Rokea

  3. #3 Guest

    Default RE: Set object = Nothing?

    It&#039s very important to realize that COM objects remove themself from memory whenever their reference count goes to zero. Setting something equal to Nothing will lower the reference count by 1. When the count is equal to zero it will them remove itself from memory. The reference count is also lowered when an object goes out of scope. The reason why people implicitly set an object equal to nothing is that NT/9x is known to sometimes not lower the reference count on an object when it goes out of scope.

  4. #4
    Join Date
    Dec 1969

    Default RE: Set object = Nothing?

    It is always best to set objects to nothing.<BR>However...<BR>You should take your object out of the Session.<BR>When you put an object (Set Session("X") =...) , all subsequent page requests during the life of that object must be marshalled and run on the same IIS thread.<BR>Putting your connection object in the session maintains an active connetion until the session expires, adds a connection for every user and eliminates the benifits of pooling .<BR><BR>Store the information you need to establish the connection inyour session.Create and destroy it on every page<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts