How to allocate and de-allocate the memory thr' C# with example coding?
c# coding
Collapse
This topic is closed.
X
X
-
vijiTags: None -
clintonG
Re: c# coding
We don't need to alloc anymore which is why develolping ASP.NET is called
Managed Code. As for examples you should spend some time learning what
ASP.NET actually is and how the compiler works.
//try this to get started using the overview keyword
//Microsoft uses this keyword for --everything-- we want
//to learn about
//search
asp.net overview site:msdn2.micr osoft.com
//search
managed code overview site:msdn2.micr osoft.com
"viji" <ashtasarathy@g mail.comwrote in message
news:95d34637-dbc8-476a-84c0-5b73a396eeb7@i7 g2000prf.google groups.com...How to allocate and de-allocate the memory thr' C# with example coding? -
Bob Powell [MVP]
Re: c# coding
//allocate
thing X=new thing();
//deallocate
x.Dispose(); //(optional if object implements dispose pattern)
x=null;
In managed code, memory is deallocated by the garbage collector when it's no
longer needed.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
Find great Windows Forms articles in Windows Forms Tips and Tricks
Answer those GDI+ questions with the GDI+ FAQ
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"viji" <ashtasarathy@g mail.comwrote in message
news:95d34637-dbc8-476a-84c0-5b73a396eeb7@i7 g2000prf.google groups.com...How to allocate and de-allocate the memory thr' C# with example coding?Comment
-
Robert Fuchs
Re: c# coding
why are you talking about ASP.NET?
Nobody asked for that.
The OP asked about C#...
regards, Robert
Comment
-
Richard Blewett
Re: c# coding
"Bob Powell [MVP]" <bob@spamkiller bobpowell.netwr ote in message
news:FB1037E7-838C-4DB9-AE3B-A9F0D5040AE5@mi crosoft.com...If the OP really wants to talk about *memory* then the call to Dispose does//allocate
thing X=new thing();
>
//deallocate
x.Dispose(); //(optional if object implements dispose pattern)
x=null;
>
In managed code, memory is deallocated by the garbage collector when it's
no longer needed.
>
--
nothing about memory but does allow the object to clear up non-memory
resources.
The setting of x to null is unnecessary and doesn;t do anything at all as x
is a local variable. If x was static then setting to null would be vital in
allowing the object to be cleaned up. If x were a member variable then
setting it to null *might* be worth it
--
Regards
Richard Blewett
DevelopMentor
Comment
-
Jon
Re: c# coding
"but does allow the object to clear up non-memory resources"
Which may themselves use memory.
"Richard Blewett" <richardb@devel op.comwrote in message
news:59B6A9D5-4D30-4B30-ABF5-87C76072E089@mi crosoft.com...
"Bob Powell [MVP]" <bob@spamkiller bobpowell.netwr ote in message
news:FB1037E7-838C-4DB9-AE3B-A9F0D5040AE5@mi crosoft.com...If the OP really wants to talk about *memory* then the call to Dispose does//allocate
thing X=new thing();
>
//deallocate
x.Dispose(); //(optional if object implements dispose pattern)
x=null;
>
In managed code, memory is deallocated by the garbage collector when it's
no longer needed.
>
--
nothing about memory but does allow the object to clear up non-memory
resources.
The setting of x to null is unnecessary and doesn;t do anything at all as x
is a local variable. If x was static then setting to null would be vital in
allowing the object to be cleaned up. If x were a member variable then
setting it to null *might* be worth it
--
Regards
Richard Blewett
DevelopMentor
Comment
Comment