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

C#

 
AnswerRe: Creating a SELECT Query Based on Textbox Data Pin
Wendelius19-Jul-15 5:25
mentorWendelius19-Jul-15 5:25 
AnswerRe: Creating a SELECT Query Based on Textbox Data Pin
Dave Kreskowiak19-Jul-15 6:29
mveDave Kreskowiak19-Jul-15 6:29 
AnswerRe: Creating a SELECT Query Based on Textbox Data Pin
F-ES Sitecore19-Jul-15 22:29
professionalF-ES Sitecore19-Jul-15 22:29 
AnswerRe: Creating a SELECT Query Based on Textbox Data Pin
Richard Deeming20-Jul-15 6:58
mveRichard Deeming20-Jul-15 6:58 
Questionan unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
BillWoodruff19-Jul-15 4:05
professionalBillWoodruff19-Jul-15 4:05 
AnswerRe: an unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
Alan N19-Jul-15 9:44
Alan N19-Jul-15 9:44 
GeneralRe: an unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
BillWoodruff19-Jul-15 11:46
professionalBillWoodruff19-Jul-15 11:46 
GeneralRe: an unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
Member 1113646119-Jul-15 10:01
Member 1113646119-Jul-15 10:01 
Quote:
Running the above code, then closing 'Form2 by clicking its Form Close Button, and then moving 'Form1 does not then throw an error which makes me believe that the reference to 'Form2 in that created-lambda EventHandler must still be valid.



What you are seeing is by design as the garbage collector makes the following guarantees:

1. Every object will be destroyed, and its destructor will be run. When a program ends, all remaining objects will be destroyed.
2. Every object will be destroyed exactly once.
3. Every object will be destroyed only when it becomes unreachable, i.e. when there are no references to the object in the process running your application.

The garbage collector works on its own thread and can execute only at certain times, while it runs other threads in you application are temporarily halted in case it needs to move obects around and update references.

Generally the following steps are taken by the garbage collector:

1. builds a map of the reachable objects
2. checks if any unreachable objects have a destructor that needs to be run (i.e finalization, if any are found they are moved to a special queue)
3. Deallocation of remaining unreachable objects, and moves reachable objects down the heap, updates any references to the reachable objects
4. allows other threads to resume
5. Runs the finalized methods from number 2
GeneralRe: an unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
BillWoodruff19-Jul-15 11:49
professionalBillWoodruff19-Jul-15 11:49 
AnswerRe: an unexpected absence of fail ... using anonymous actions in a WinForm EventHandler Pin
Richard Deeming20-Jul-15 6:43
mveRichard Deeming20-Jul-15 6:43 
QuestionApplication is Crashing Pin
Jassim Rahma19-Jul-15 1:10
Jassim Rahma19-Jul-15 1:10 
AnswerRe: Application is Crashing Pin
OriginalGriff19-Jul-15 1:36
mveOriginalGriff19-Jul-15 1:36 
AnswerRe: Application is Crashing Pin
Dave Kreskowiak19-Jul-15 3:54
mveDave Kreskowiak19-Jul-15 3:54 
QuestionHow to get google place predictions with latitude, longitude and address based on Textbox entry in c# Pin
sr15918-Jul-15 19:05
sr15918-Jul-15 19:05 
AnswerRe: How to get google place predictions with latitude, longitude and address based on Textbox entry in c# Pin
OriginalGriff18-Jul-15 20:17
mveOriginalGriff18-Jul-15 20:17 
QuestionCar tracker Pin
lolinga218-Jul-15 8:58
lolinga218-Jul-15 8:58 
AnswerRe: Car tracker Pin
Dave Kreskowiak18-Jul-15 9:36
mveDave Kreskowiak18-Jul-15 9:36 
GeneralRe: Car tracker Pin
lolinga218-Jul-15 9:42
lolinga218-Jul-15 9:42 
GeneralRe: Car tracker Pin
Mycroft Holmes18-Jul-15 14:35
professionalMycroft Holmes18-Jul-15 14:35 
QuestionError Converting String to Int Pin
Broodje Games18-Jul-15 2:26
Broodje Games18-Jul-15 2:26 
AnswerRe: Error Converting String to Int Pin
OriginalGriff18-Jul-15 2:31
mveOriginalGriff18-Jul-15 2:31 
AnswerRe: Error Converting String to Int Pin
miki-bgd18-Jul-15 5:12
miki-bgd18-Jul-15 5:12 
QuestionHide a Panel on MDI Container Pin
Jassim Rahma17-Jul-15 11:13
Jassim Rahma17-Jul-15 11:13 
AnswerRe: Hide a Panel on MDI Container Pin
Eddy Vluggen17-Jul-15 11:59
professionalEddy Vluggen17-Jul-15 11:59 
QuestionComplexity Pin
Gilbert Consellado16-Jul-15 22:37
professionalGilbert Consellado16-Jul-15 22:37 

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.