Created
September 24, 2013 21:20
-
-
Save kumpera/6691428 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace ConsoleApplication8 | |
| { | |
| class Program | |
| { | |
| static object value; | |
| static void Main (string[] args) | |
| { | |
| WeakReference weak = null; | |
| var v = new System.Threading.Thread (() => { value = new object(); weak = new WeakReference (value); }); | |
| v.Start (); v.Join (); | |
| value = null; | |
| GC.Collect(); | |
| GC.WaitForPendingFinalizers(); | |
| GC.Collect(); | |
| Console.WriteLine (weak.IsAlive); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment