Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
GeneralCast Problem Pin
Jochen Jonckheere7-Apr-04 0:28
Jochen Jonckheere7-Apr-04 0:28 
GeneralRe: Cast Problem Pin
Bill Dean7-Apr-04 1:44
Bill Dean7-Apr-04 1:44 
QuestionHow to delete file on client side using remote object Pin
dephlocus6-Apr-04 23:54
dephlocus6-Apr-04 23:54 
AnswerRe: How to delete file on client side using remote object Pin
Judah Gabriel Himango7-Apr-04 4:06
sponsorJudah Gabriel Himango7-Apr-04 4:06 
GeneralMem Usage Pin
DougW486-Apr-04 23:25
DougW486-Apr-04 23:25 
GeneralRe: Mem Usage Pin
Dave Kreskowiak7-Apr-04 1:35
mveDave Kreskowiak7-Apr-04 1:35 
GeneralRe: Mem Usage Pin
DougW487-Apr-04 1:43
DougW487-Apr-04 1:43 
GeneralRe: Mem Usage Pin
Heath Stewart7-Apr-04 6:13
protectorHeath Stewart7-Apr-04 6:13 
While the task mgr isn't the greatest performance monitor, it will indicate at least when memory goes up or down. Keep in mind that an operating system's job is to dish out memory when allocation requests come in. It WILL know how much is being given to an application because the OS is what's giving the application working memory.

One thing about forms, though, you need to dispose of them if you ever display a modal dialog via ShowDialog. A simple way of doing this is like:
using (MyForm form = new MyForm())
{
  myForm.ShowDialog();
}
This disposes native handles (memory addresses) that the CLR does not manage, which is why you keep seeing your memory go up and up when you open new forms. You can also do this modeless forms (via Show), but it's not necessary.

Basically, any type that implements IDisposable and uses native handles (like FileIOStream) should be disposed when you're done using it. With System.Windows.Forms.Control you typically don't need to as it cleans up itself pretty well, but disposing it wouldn't hurt when you're done.

It all comes down the CLR and the garbage collector. The reason .NET languages are also call managed languages is because they're managed by the CLR. But native handles aren't managed by the CLR, so you need to make sure that they're "clean-up" (i.e., native resources are released).

 

Microsoft MVP, Visual C#
My Articles
GeneralUserControl and interface implementation Pin
Corneliu Tusnea6-Apr-04 22:28
Corneliu Tusnea6-Apr-04 22:28 
GeneralRe: UserControl and interface implementation Pin
Heath Stewart7-Apr-04 5:46
protectorHeath Stewart7-Apr-04 5:46 
GeneralRe: UserControl and interface implementation Pin
Corneliu Tusnea7-Apr-04 13:26
Corneliu Tusnea7-Apr-04 13:26 
Generaluneable to update an Access database Pin
michael.wikstrom6-Apr-04 22:14
michael.wikstrom6-Apr-04 22:14 
GeneralRe: uneable to update an Access database Pin
Heath Stewart7-Apr-04 4:49
protectorHeath Stewart7-Apr-04 4:49 
GeneralAutomailer Pin
sreejith ss nair6-Apr-04 19:54
sreejith ss nair6-Apr-04 19:54 
GeneralRe: Automailer Pin
Dave Kreskowiak7-Apr-04 1:43
mveDave Kreskowiak7-Apr-04 1:43 
QuestionHow to get the IP of SqlServer? Pin
Member 6449646-Apr-04 19:53
Member 6449646-Apr-04 19:53 
AnswerRe: How to get the IP of SqlServer? Pin
Colin Angus Mackay7-Apr-04 0:12
Colin Angus Mackay7-Apr-04 0:12 
GeneralRe: How to get the IP of SqlServer? Pin
Member 6449647-Apr-04 15:58
Member 6449647-Apr-04 15:58 
GeneralRe: How to get the IP of SqlServer? Pin
Dave Kreskowiak8-Apr-04 3:06
mveDave Kreskowiak8-Apr-04 3:06 
AnswerRe: How to get the IP of SqlServer? Pin
Heath Stewart7-Apr-04 4:42
protectorHeath Stewart7-Apr-04 4:42 
GeneralRe: How to get the IP of SqlServer? Pin
Member 6449647-Apr-04 16:00
Member 6449647-Apr-04 16:00 
GeneralDatagrid Record Numbering Pin
sreejith ss nair6-Apr-04 19:49
sreejith ss nair6-Apr-04 19:49 
GeneralRe: Datagrid Record Numbering Pin
Heath Stewart7-Apr-04 3:52
protectorHeath Stewart7-Apr-04 3:52 
QuestionMicrosoft.DirectX and image ??? Pin
student66696-Apr-04 19:39
student66696-Apr-04 19:39 
AnswerRe: Microsoft.DirectX and image ??? Pin
CWIZO6-Apr-04 20:52
CWIZO6-Apr-04 20:52 

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.