Click here to Skip to main content
15,920,687 members
Home / Discussions / C#
   

C#

 
GeneralRe: Garbage Collection & Memory Leaks. Pin
coleydog29-Apr-07 22:40
coleydog29-Apr-07 22:40 
AnswerRe: Garbage Collection & Memory Leaks. Pin
Christian Graus29-Apr-07 0:14
protectorChristian Graus29-Apr-07 0:14 
GeneralRe: Garbage Collection & Memory Leaks. Pin
coleydog29-Apr-07 5:25
coleydog29-Apr-07 5:25 
GeneralRe: Garbage Collection & Memory Leaks. Pin
Christian Graus29-Apr-07 10:52
protectorChristian Graus29-Apr-07 10:52 
GeneralRe: Garbage Collection & Memory Leaks. Pin
coleydog29-Apr-07 16:36
coleydog29-Apr-07 16:36 
GeneralRe: Garbage Collection & Memory Leaks. Pin
Christian Graus29-Apr-07 18:15
protectorChristian Graus29-Apr-07 18:15 
GeneralRe: Garbage Collection & Memory Leaks. Pin
coleydog29-Apr-07 22:56
coleydog29-Apr-07 22:56 
GeneralRe: Garbage Collection & Memory Leaks. Pin
caix29-Apr-07 14:11
caix29-Apr-07 14:11 
For most variables if you declare them in a function:

private void DoSomething()
{
MyClass yada;

yada = new MyClass();
}

Then yada gets garbage collected at the end of the function.
But if we do:
private void DoSomething()
{
Form2 yada;

yada = new Form2();
yada.Show();
}

Then yada doesn't get GC.
As Christian says, Dispose() will set it ready for GC, but it will take its own sweet time.
However do you really need to keep creating this form again and again, can't you declare it as an object in you main class, that you just show/hide when you need it. That will stop the memory allocation each time.
GeneralRe: Garbage Collection & Memory Leaks. Pin
coleydog29-Apr-07 16:19
coleydog29-Apr-07 16:19 
GeneralRe: Garbage Collection & Memory Leaks. Pin
Dave Kreskowiak29-Apr-07 16:55
mveDave Kreskowiak29-Apr-07 16:55 
QuestionHow to get Status of Process (Urgent) Pin
Sanjib Raj28-Apr-07 22:18
Sanjib Raj28-Apr-07 22:18 
AnswerRe: How to get Status of Process (Urgent) Pin
Amir Jalaly29-Apr-07 1:51
Amir Jalaly29-Apr-07 1:51 
QuestionMVC custom control Pin
alex.barylski28-Apr-07 20:22
alex.barylski28-Apr-07 20:22 
AnswerRe: MVC custom control Pin
Christian Graus28-Apr-07 21:38
protectorChristian Graus28-Apr-07 21:38 
GeneralRe: MVC custom control Pin
alex.barylski29-Apr-07 7:41
alex.barylski29-Apr-07 7:41 
GeneralRe: MVC custom control Pin
Christian Graus29-Apr-07 11:02
protectorChristian Graus29-Apr-07 11:02 
Questionoverlaying image on a video file Pin
enamulhoque28-Apr-07 19:27
enamulhoque28-Apr-07 19:27 
AnswerRe: overlaying image on a video file Pin
Christian Graus28-Apr-07 21:39
protectorChristian Graus28-Apr-07 21:39 
GeneralRe: overlaying image on a video file Pin
enamulhoque29-Apr-07 4:27
enamulhoque29-Apr-07 4:27 
GeneralRe: overlaying image on a video file Pin
Christian Graus29-Apr-07 10:51
protectorChristian Graus29-Apr-07 10:51 
QuestionUnsafe code Pin
xibeifeijian28-Apr-07 15:54
xibeifeijian28-Apr-07 15:54 
AnswerRe: Unsafe code Pin
Christian Graus28-Apr-07 16:50
protectorChristian Graus28-Apr-07 16:50 
GeneralRe: Unsafe code Pin
xibeifeijian28-Apr-07 17:12
xibeifeijian28-Apr-07 17:12 
GeneralRe: Unsafe code Pin
Arun.Immanuel28-Apr-07 17:14
Arun.Immanuel28-Apr-07 17:14 
GeneralRe: Unsafe code Pin
Christian Graus28-Apr-07 17:44
protectorChristian Graus28-Apr-07 17:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.