Pool

Pool

概要

実装

    2: struct Pool {
    3:         char*  name;
    4:         ulong  maxsize;
    5: 
    6:         ulong  cursize;
    7:         ulong  curfree;
    8:         ulong  curalloc;
    9: 
   10:         ulong  minarena;        /* smallest size of new arena */
   11:         ulong  quantum; /* allocated blocks should be multiple of */
   12:         ulong  minblock;        /* smallest newly allocated block */
   13: 
   14:         void*  freeroot;        /* actually Free* */
   15:         void*  arenalist;       /* actually Arena* */
   16: 
   17:         void*  (*alloc)(ulong);
   18:         int    (*merge)(void*, void*);
   19:         void   (*move)(void* from, void* to);
   20: 
   21:         int    flags;
   22:         int    nfree;
   23:         int    lastcompact;
   24: 
   25:         void   (*lock)(Pool*);
   26:         void   (*unlock)(Pool*);
   27:         void   (*print)(Pool*, char*, ...);
   28:         void   (*panic)(Pool*, char*, ...);
   29:         void   (*logstack)(Pool*);
   30: 
   31:         void*  private;
   32: };