Click here to Skip to main content
15,918,125 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
Marc Clifton1-Dec-19 12:14
mvaMarc Clifton1-Dec-19 12:14 
QuestionInfo on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 3:30
Cp-Coder30-Nov-19 3:30 
AnswerRe: Info on tests mentioning manufacturer's name and product Pin
OriginalGriff30-Nov-19 3:36
mveOriginalGriff30-Nov-19 3:36 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 3:39
Cp-Coder30-Nov-19 3:39 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Nelek30-Nov-19 9:52
protectorNelek30-Nov-19 9:52 
GeneralI love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 1:00
mvahoney the codewitch30-Nov-19 1:00 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
Greg Utas30-Nov-19 4:07
professionalGreg Utas30-Nov-19 4:07 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 4:13
mvahoney the codewitch30-Nov-19 4:13 
It's a special object the GC knows about. There's a non-generic version called WeakReference but it's better to use the generic one, even with an object type, for reasons I won't get into here.

Basically what it means is that the weak reference holds something, but what it holds isn't counted against that target's references.

Meaning the object will "die" if nothing else is referring to it. The weakreference itself doesn't count as a reference to the garbage collector.

Basically, this is useful usually in cases where a child class needs to hold a reference to a parent.

Normally you also have the typical links from the parent to the child. Well, this creates a circular dependency which makes the objects not disposed of because they always reference each other. It's a "robin hood little john problem" if you've encountered those. The one reference will always keep the other alive and vice versa. Here you should keep the parent as a weak reference.

I'm not using it that way though. I'm using it to keep track of changes in an object "graph" i don't own. Basically if the tree gets restructured behind by back, and objects get orphaned, this way i know about it next time i crawl the tree from where I'm at (since I've inserted parent pointers as tags throughout the tree)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

PraiseRe: I love getting the garbage collector to do my other chores too Pin
User 1106097930-Nov-19 5:36
User 1106097930-Nov-19 5:36 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 5:44
mvahoney the codewitch30-Nov-19 5:44 
PraiseRe: I love getting the garbage collector to do my other chores too Pin
Daniel Pfeffer30-Nov-19 8:13
professionalDaniel Pfeffer30-Nov-19 8:13 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 8:21
mvahoney the codewitch30-Nov-19 8:21 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
BillWoodruff30-Nov-19 23:16
professionalBillWoodruff30-Nov-19 23:16 
GeneralCcc answer Pin
The pompey30-Nov-19 0:46
The pompey30-Nov-19 0:46 
GeneralRe: Ccc answer Pin
OriginalGriff30-Nov-19 1:28
mveOriginalGriff30-Nov-19 1:28 
GeneralThought of the Day Pin
OriginalGriff29-Nov-19 4:39
mveOriginalGriff29-Nov-19 4:39 
GeneralRe: Thought of the Day Pin
Peter_in_278029-Nov-19 4:52
professionalPeter_in_278029-Nov-19 4:52 
GeneralRe: Thought of the Day Pin
Mike Hankey29-Nov-19 4:59
mveMike Hankey29-Nov-19 4:59 
AnswerRe: Thought of the Day Pin
lopatir29-Nov-19 5:52
lopatir29-Nov-19 5:52 
GeneralRe: Thought of the Day Pin
Duncan Edwards Jones29-Nov-19 6:10
professionalDuncan Edwards Jones29-Nov-19 6:10 
GeneralRe: Thought of the Day Pin
Ravi Bhavnani29-Nov-19 6:33
professionalRavi Bhavnani29-Nov-19 6:33 
GeneralRe: Thought of the Day Pin
DRHuff29-Nov-19 7:13
DRHuff29-Nov-19 7:13 
GeneralRe: Thought of the Day Pin
Eddy Vluggen29-Nov-19 7:37
professionalEddy Vluggen29-Nov-19 7:37 
GeneralQuick C# quiz Pin
honey the codewitch29-Nov-19 4:33
mvahoney the codewitch29-Nov-19 4:33 
GeneralRe: Quick C# quiz PinPopular
OriginalGriff29-Nov-19 4:40
mveOriginalGriff29-Nov-19 4:40 

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.