|
-
Apr 15th, 2002, 10:57 PM
#1
Thread Starter
Junior Member
my threading causes memory leaks?
well.. hmm.. seems that my program take up about 10 meg ram runnin.. but when i start the threading part.. it jumps to 35..
ok.. so fine.. but when i close that form... (its a different form than the main) the memory is never free'd up.. and i know all the threads exited.. cause it outputs on the console... .. i have it testing in the procedure that the thread runs. for a variable.. and if it see's it. it exits the sub...
and when i reopen that form. it eats up 10-15 more megs.. and so on and so on..
question is
how are you possed to stop threads? or. how do you free the ram the threads were runnin on.
thanks
karthic
-
Apr 15th, 2002, 11:00 PM
#2
Thread Starter
Junior Member
FORGOT TO MENTION
and when i exit the program.. it actually doesnt close the way.. the form closes.. but its still in memory. till i end it..
thanks
------------------------------------------------------------------
ignore this reply... i found that mistake.. i had a never ending do loop.. but still takes up 35 megs ram till the program completly closes.. and continully takes more.. if i close and reopen that window...
karthic
Last edited by karthic; Apr 16th, 2002 at 07:36 AM.
-
Apr 16th, 2002, 07:55 PM
#3
Thread Starter
Junior Member
hmm ok. its like this
well.. ok.. its like this.. my program creates threads.. and then they die.. doesnt keep track of em
just create em and die.. and every time start and stop that part of it.. it constantly adds 15 more megs ram to my process used.. anyone know?
thanks
-
Apr 17th, 2002, 05:00 AM
#4
Although it may look like a memory leak, it probably isn't.
Assuming you use managed code (API's can still cause memory and other leaks) the garbage collector will do its work.
But, you can't say when the garbage collector will free the memory. As soon as memory will become scarce, the garbage collector will jump in, but as long as there is enough memory available, the garbage collector can take it's time before it does it's job.
To force garbage collection at specific moment you can use System.GC.Collect, but it shouldn't be necessary.
In short: as long as you use managed code, you should not need to worry about memory leaks.
-
May 27th, 2002, 08:57 PM
#5
Thread Starter
Junior Member
managed code?
managed code?
i'm sorry.. can you explain or direct me to where managed code is explained?
thanks
-
May 28th, 2002, 11:32 AM
#6
Some places to look in the VS.NET help file:
Overview of the .NET framework
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpovrintroductiontonetframeworksdk.htm
GC Class
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemGCClassTopic.htm
And another one:
Automatic Memory Management
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconautomaticmemorymanagement.htm
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
|