PennMUSH Community
Show
Ignore:
Timestamp:
07/08/07 20:50:12 (1 year ago)
Author:
shawnw
Message:

Merged 1.8.3p4 into trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/trunk/hdrs/mymalloc.h

    r919 r1032  
    55#ifndef _MYMALLOC_H 
    66#define _MYMALLOC_H 
    7  
    8 #ifdef WIN32 
    9 #undef malloc 
    10 #undef calloc 
    11 #undef realloc 
    12 #undef free 
    13 #endif 
    14  
    15 /* If you're using gmalloc on some linux kernels, and have trouble 
    16  * with the compile, consider uncommenting this line: */ 
    17 /*#undef I_MALLOC */ 
    18 #ifdef I_MALLOC 
    19 #include <malloc.h> 
    20 #endif 
    217 
    228#include "options.h" 
     
    3319#endif 
    3420 
     21typedef struct slab slab; 
     22slab *slab_create(const char *name, size_t item_size); 
     23void slab_destroy(slab *); 
     24void *slab_malloc(slab *sl, const void *hint); 
     25void slab_free(slab *sl, void *obj); 
     26 
     27enum slab_options { 
     28  SLAB_ALLOC_FIRST_FIT, /**< When allocating without a hint (Or when a 
     29                           hint page is full) , use the first page 
     30                           found with room for the object. Default. Mutually exclusive with SLAB_ALLOC_BEST_FIT. */ 
     31  SLAB_ALLOC_BEST_FIT, /**< When allocating without a hint (Or when a 
     32                          hint page is full), use the page with the 
     33                          fewest free objects. Mutually exclusive with SLAB_ALLOC_FIRST_FIT. */ 
     34 
     35  SLAB_ALWAYS_KEEP_A_PAGE, /**< If set to 1, do not delete an empty 
     36                             page if it is the only page allocated for 
     37                             that slab. Defaults to 0. */ 
     38 
     39  SLAB_HINTLESS_THRESHOLD /**< The number of free objects that must 
     40                              exist in a page for a hintless object to 
     41                              be allocated from it. Defaults to 
     42                              1. Raise for cases where you'll have a 
     43                              lot of allocations using hints and 
     44                              deletions, to improve caching -- e.g., 
     45                              attributes. */ 
     46}; 
     47 
     48void slab_set_opt(slab *sl, enum slab_options opt, int val); 
     49 
    3550#endif                          /* _MYMALLOC_H */