daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest May 16th, 2018 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. module tango.util.container.mgmt.GCAllocator;
  3.  
  4. public import tango.util.container.mgmt.Allocator;
  5.  
  6. /*******************************************************************************
  7.  
  8.         Generic GC allocations
  9.        
  10. *******************************************************************************/
  11.  
  12. class GCAllocator(T) : Allocator!(T)
  13. {
  14.        
  15.         /***********************************************************************
  16.  
  17.                 allocate a fixed-size (T) chunk of memory
  18.                
  19.         ***********************************************************************/
  20.  
  21.         final override void[] allocate ()
  22.         {
  23.                 return allocate (T.sizeof);
  24.         }
  25.  
  26.         /***********************************************************************
  27.  
  28.                 allocate an arbitrary chunk of memory
  29.                
  30.         ***********************************************************************/
  31.  
  32.         final override void[] allocate (uint size)
  33.         {
  34.                 return new void[size];
  35.         }
  36.  
  37.         /***********************************************************************
  38.  
  39.                 Invoked during a client .dup to clone an attached allocator
  40.                
  41.         ***********************************************************************/
  42.  
  43.         final override GCAllocator factory ()
  44.         {
  45.                 return this;
  46.         }
  47.  
  48.         /***********************************************************************
  49.  
  50.                 Invoked when clear/reset is called on the host. Parameter
  51.                 all indicated whether all memory usage should be collected
  52.                 or just the fixed-size blocks
  53.                
  54.         ***********************************************************************/
  55.  
  56.         final override void collect (bool all)
  57.         {
  58.         }
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top