Allocate memory with System.Runtime.MemoryFailPoint : Memory : Windows C# Examples


C# Examples » Windows » Memory »

 

Allocate memory with System.Runtime.MemoryFailPoint









    
using  System;
using  System.Collections.Generic;
using  System.Diagnostics;
using  System.Runtime.CompilerServices;

public  class  MainClass
{

        public  static  void  Main()
        {
                using  (System.Runtime.MemoryFailPoint  gate  =  new  System.Runtime.MemoryFailPoint(100))
                {
                        //  Some  operation  that  actually  uses  the  100MB  of  memory?                        Console.WriteLine("Success  for  100MB  fail-point");
                }

                using  (System.Runtime.MemoryFailPoint  gate  =  new  System.Runtime.MemoryFailPoint(1024*100))
                {
                        //  Some  operation  that  actually  uses  the  100GB  of  memory?                        Console.WriteLine("Success  for  100GB  fail-point");
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Windows
» Memory