Created
July 1, 2013 20:06
-
-
Save kumpera/5904093 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; | |
| using System.Threading; | |
| class Driver { | |
| static void AllocStuff () | |
| { | |
| var x = new object (); | |
| for (int i = 0; i < 300; ++i) | |
| x = new byte [i]; | |
| } | |
| static void BackgroundNoise () | |
| { | |
| while (true) | |
| AllocStuff (); | |
| } | |
| static void Main () { | |
| for (int i = 0; i < Environment.ProcessorCount; ++i) { | |
| var t = new Thread (BackgroundNoise); | |
| t.IsBackground = true; | |
| t.Start (); | |
| } | |
| for (int i = 0; i < 100; ++i) { | |
| var ad = AppDomain.CreateDomain ("domain_" + i); | |
| ad.DoCallBack (new CrossAppDomainDelegate (AllocStuff)); | |
| AppDomain.Unload (ad); | |
| Console.Write ("."); | |
| if (i > 0 && i % 20 == 0) Console.WriteLine (); | |
| } | |
| Console.WriteLine ("\ndone"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment