![]() |
|
#1
|
|||
|
|||
C# - freeing memory allocated by the 'new' operatorI can use 'new' to allocate memory to the same pointer more than once.
I don't see any way to free an allocation before requesting another. Is this taken care of by this 'garbage collection' stuff I keep hearing about? If so , I still haven't recieved the bill. What is the billing cycle? Seriously , Does that happen automatically when I make the new request? Is there something wrong with cleaning up my own trash? example: C-SHARP / C# Code:
Code:
|
|||
|
#2
|
|||
|
|||
Re: C# - freeing memory allocated by the 'new' operatorYes, it is done by the garbage collector. If you want to clean up after an object before the garbage collector gets to it, you can use the Dispose() method of the object if it implements IDisposable.
|
|
#3
|
|||
|
|||
Re: C# - freeing memory allocated by the 'new' operatorThanks
I read up a bit on Dispose etc. Interesting. They talk like I should not worry about arrays as the GC will clean it up if needed. How handy... |
|
#4
|
|||
|
|||
Re: C# - freeing memory allocated by the 'new' operatorYeah, it makes going back to C++ very difficult for those that learn with C# because they don't understand about freeing resources. Luckily for us, we learned C/C++ before C#.
|
|
#5
|
|||
|
|||
Re: C# - freeing memory allocated by the 'new' operatorPersonally , for the C# gods to think that we NEED to have GC running around wiping my butt to the point that they don't even give us an easy to use deallocation method because WE might not use it correctly is flippin insulting. Managed code... managed people , like cattle. ms...
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A Complete Guide to SD Memory Cards | haulkook | Computer Hardware Forum | 0 | 02-Jul-2008 00:27 |
| A Few Tips on Buying Good Memory Cards and other Hi-Tech Electronic Accessories | haulkook | Computer Hardware Forum | 0 | 02-Jun-2008 04:53 |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 20:23 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 18:36 |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 19:35 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The