Click here to Skip to main content
15,881,793 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting network & computer names Pin
Heath Stewart19-Jan-04 4:37
protectorHeath Stewart19-Jan-04 4:37 
GeneralRe: Getting network & computer names Pin
Ashraf Alsadiq19-Jan-04 18:13
Ashraf Alsadiq19-Jan-04 18:13 
GeneralTRACE Pin
bouli19-Jan-04 1:27
bouli19-Jan-04 1:27 
GeneralRe: TRACE Pin
Colin Angus Mackay19-Jan-04 1:44
Colin Angus Mackay19-Jan-04 1:44 
GeneralRe: TRACE Pin
bouli19-Jan-04 1:53
bouli19-Jan-04 1:53 
GeneralRe: TRACE Pin
Heath Stewart19-Jan-04 4:34
protectorHeath Stewart19-Jan-04 4:34 
GeneralI'm a bit confused here! Pin
profoundwhispers19-Jan-04 1:18
profoundwhispers19-Jan-04 1:18 
GeneralRe: I'm a bit confused here! Pin
Colin Angus Mackay19-Jan-04 1:57
Colin Angus Mackay19-Jan-04 1:57 
profoundwhispers wrote:
Object o; //Where does o fit in memory?

It allocates enough memory on the stack for a reference (pointer) to the actual object (what ever it may eventually be)

profoundwhispers wrote:
o = new Object(); //Now what? Instantiated? What's that?!

This allocates memory on the heap for the newly instantiated object.

profoundwhispers wrote:
o = some_fuction_that_returns_a_newly_created_object(); //Now?

the actual newly created object will be on the heap. o itself is still a pointer/reference on the stack to that object.

profoundwhispers wrote:
How about the first o that was allocated? ... What happens to the first instance?

The garbage collector will remove it from the system when it gets around to it, assuming nothing else is referencing it.

profoundwhispers wrote:
What about if I want to destroy this o in memory because I simply don't need it anymore?!

If you don't need it anymore just don't reference it. The garbage collector will free the memory when it gets around to it.

One caveat is objects that have a Dispose() method. These usually have resources that the managed heap in .NET cannot garbage collect efficiently. When you no longer need these objects you should call Dispose(). The garbage collector would eventually Dispose it anyway, but it will take a few attempts at it.

--Colin Mackay--

EuroCPian Spring 2004 Get Together[^]


GeneralRe: I'm a bit confused here! Pin
profoundwhispers19-Jan-04 3:13
profoundwhispers19-Jan-04 3:13 
GeneralDataSources and ListViews Pin
rstrokur19-Jan-04 0:00
rstrokur19-Jan-04 0:00 
GeneralRe: DataSources and ListViews Pin
Heath Stewart19-Jan-04 4:29
protectorHeath Stewart19-Jan-04 4:29 
QuestionHow do I change the ALT-TAB icon ? Pin
Jan R Hansen18-Jan-04 23:30
Jan R Hansen18-Jan-04 23:30 
AnswerRe: How do I change the ALT-TAB icon ? Pin
Heath Stewart19-Jan-04 4:25
protectorHeath Stewart19-Jan-04 4:25 
GeneralReplacement for multiple inheritance Pin
Severino18-Jan-04 23:25
Severino18-Jan-04 23:25 
GeneralRe: Replacement for multiple inheritance Pin
Colin Angus Mackay19-Jan-04 2:09
Colin Angus Mackay19-Jan-04 2:09 
GeneralSoftware Testing tool Pin
Member 33502218-Jan-04 22:47
Member 33502218-Jan-04 22:47 
GeneralRe: Software Testing tool Pin
Colin Angus Mackay19-Jan-04 2:11
Colin Angus Mackay19-Jan-04 2:11 
GeneralWindows Service with Balloon Tooltips Pin
jochen vg18-Jan-04 22:40
jochen vg18-Jan-04 22:40 
GeneralRe: Windows Service with Balloon Tooltips Pin
Heath Stewart19-Jan-04 4:21
protectorHeath Stewart19-Jan-04 4:21 
GeneralWH_KEYBOARD Global Hook Pin
gekoscan18-Jan-04 20:55
gekoscan18-Jan-04 20:55 
GeneralRe: WH_KEYBOARD Global Hook Pin
Duncan Edwards Jones18-Jan-04 21:37
professionalDuncan Edwards Jones18-Jan-04 21:37 
GeneralI don't believe this is the case Pin
gekoscan18-Jan-04 22:11
gekoscan18-Jan-04 22:11 
GeneralRe: I don't believe this is the case Pin
Duncan Edwards Jones19-Jan-04 1:55
professionalDuncan Edwards Jones19-Jan-04 1:55 
GeneralPreview of custom file type Pin
Shree18-Jan-04 20:54
Shree18-Jan-04 20:54 
GeneralRe: Preview of custom file type Pin
Heath Stewart19-Jan-04 3:51
protectorHeath Stewart19-Jan-04 3:51 

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.