|
-
Jul 15th, 2009, 03:41 PM
#1
Thread Starter
Lively Member
Do new classes 'leak'?
If I have something like this within a sub/function:
Dim a as new myclass
Does this leave a memory leak if I am constantly calling this function creating new instances of this class? Do I have to destroy it or something when I am done using it?
-
Jul 15th, 2009, 03:50 PM
#2
Re: Do new classes 'leak'?
Read this article to learn a bit about how memory management in .NET works.
-
Jul 15th, 2009, 07:44 PM
#3
Frenzied Member
Re: Do new classes 'leak'?
When the Sub/Function completes, the run-time engine knows that the variable you created is no longer going to be used. The Garbage Collector will eventually reclaim the memory pointed to by that local variable.
No, a memory leak is not created in this case.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|