Home All Groups Group Topic Archive Search About

Will Dot net framework 2.0 auto free the unuse object?

Author
15 Mar 2006 8:47 AM
briancfk
Recently, my company using asp.net 2.0 to develop a web site

When I check the asp.net code, i found that there is many pages that
code as the way as below
e.g.

For i=0 to i=50
    Dim obj as new myObject()
........................
Next

The obj object that created didt free it or other word didt set to
nothing

This web site / web pages, every day or same time will have many user
browse it

What i worry is, all this obj that didt use will taking space in the
memory,  and slow down the system. and even worst, cause the system
hang

Will This HAPPEN?

And What I expect is, the Dot Net Framework will detect the memory
usage and only will free the unuse object when the memory usage is over
the specific limit.
Then it will automatic free the unuse object, Am I true?

Cause last time experience is, that is with Dot Net Frame work 1.1, it
will not free the object so efficiently. So, when i coding, I have to
very carefull to avoid the unuse object taking space in my memory and
slow down my system.

Author
15 Mar 2006 4:37 PM
Mattias Sjögren
>Will This HAPPEN?

No, if the objects are not referenced the GC will eventually clean
them up.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

AddThis Social Bookmark Button