all groups > dotnet clr > june 2004 >
You're in the

dotnet clr

group:

Doubt about Garbage collection


Doubt about Garbage collection Shiva
6/24/2004 5:27:01 AM
dotnet clr:
Hi

I am writing a chat application
I have developed the chat server in which i am creating objects that represents the communicating parties and those will stay in memory till there is communication between them

when they logout i need to destroy the object from the memory

Because the application will run forever theoritically i fear that the objects will get accumulated in memory if i dont destroy them

Can i destroy the object by setting to NOTHING?
Will it destroy the object?

should i run GC from my code?

What shall i do to get these objects out of memory?

Thanks
Re: Doubt about Garbage collection cody
6/24/2004 2:37:21 PM
GC will run automatically every few minutes or if memory is low. You can run
it manually by calling GC.Collect() but this is generally not recommended.
GC will collect all objects automatically which are not referenced from
somewhere.
If you want to destroy an object set all references to it to null and remove
the objects from all lists or arrays if you store your object in such a
collection.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Shiva" <Shiva@discussions.microsoft.com> schrieb im Newsbeitrag
news:DFAB65EC-21AF-4044-B0A4-F8E200341776@microsoft.com...
[quoted text, click to view]
represents the communicating parties and those will stay in memory till
there is communication between them
[quoted text, click to view]

AddThis Social Bookmark Button