PennMUSH Community

Changeset 1023

Show
Ignore:
Timestamp:
07/08/07 15:35:54 (1 year ago)
Author:
shawnw
Message:

gc: Initial conversion to using garbage collection

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/gc/MANIFEST

    r998 r1023  
    8686hdrs/conf.h 
    8787hdrs/copyrite.h 
    88 hdrs/csrimalloc.h 
    8988hdrs/dbdefs.h 
    9089hdrs/dbio.h 
     
    162161src/cque.c 
    163162src/create.c 
    164 src/csrimalloc.c 
    165163src/db.c 
    166164src/destroy.c 
     
    221219src/speech.c 
    222220src/sql.c 
    223 src/strdup.c 
    224221src/strtree.c 
    225222src/strutil.c 
  • 1.8.3/branches/gc/Makefile.in

    r1019 r1023  
    2222 
    2323CCFLAGS=@CFLAGS@ -I.. -I../hdrs 
    24 LDFLAGS=@LDFLAGS@ 
     24LDFLAGS=@LDFLAGS@ -lgc 
    2525CLIBS=@LIBS@ 
    2626INSTALL=@INSTALL@ 
  • 1.8.3/branches/gc/hdrs/externs.h

    r1017 r1023  
    207207extern char ucbuff[]; 
    208208#define init_compress(f) 0 
    209 #define compress(s) ((unsigned char *)strdup(s)) 
     209#define compress(s) ((unsigned char *)GC_STRDUP(s)) 
    210210#define uncompress(s) (strcpy(ucbuff, (char *) s)) 
    211 #define safe_uncompress(s) (strdup((char *) s)) 
     211#define safe_uncompress(s) (GC_STRDUP((char *) s)) 
    212212#endif 
    213213 
     
    288288void do_look_at(dbref player, const char *name, int key); 
    289289char *decompose_str(char *what); 
    290  
    291 /* From memcheck.c */ 
    292 void add_check(const char *ref); 
    293 void del_check(const char *ref, const char *filename, int line); 
    294 void list_mem_check(dbref player); 
    295 void log_mem_check(void); 
    296290 
    297291/* From move.c */ 
     
    426420 
    427421/** Unsigned char strdup. Why is this a macro when the others functions? */ 
    428 #define u_strdup(x) (unsigned char *)strdup((const char *) x) 
    429 #ifndef HAVE_STRDUP 
    430 char * 
    431 strdup(const char *s) 
    432   __attribute_malloc__; 
    433 #endif 
    434     char *mush_strdup(const char *s, const char *check) __attribute_malloc__; 
     422#define u_strdup(x) (unsigned char *)GC_STRDUP((const char *) x) 
     423#define mush_strdup(s,check) GC_STRDUP((s)) 
    435424 
    436425#ifdef HAVE__STRNCOLL 
     
    555544    void *mush_calloc(size_t count, size_t size, 
    556545                      const char *check) __attribute_malloc__; 
    557 #define mush_realloc(ptr, size, tag) \ 
    558   mush_realloc_where((ptr), (size), (tag), __FILE__, __LINE__) 
    559     void *mush_realloc_where(void *restrict ptr, size_t newsize, 
    560                              const char *restrict check, 
    561                              const char *restrict filename, int line); 
    562 #define mush_free(ptr,tag) mush_free_where((ptr), (tag), __FILE__, __LINE__) 
    563     void mush_free_where(void *restrict ptr, const char *restrict check, 
    564                          const char *restrict filename, int line); 
     546#define mush_realloc(ptr, size, tag) GC_REALLOC((ptr), (size)) 
     547#ifndef GC_COLLECT_INSTEAD_OF_FREE 
     548#define mush_free(ptr, tag) GC_FREE((ptr)) 
     549#else 
     550#define mush_free(ptr, tag) (void)0; 
     551#endif 
    565552    long get_random_long(long low, long high); 
    566553    char *fullalias(dbref it); 
  • 1.8.3/branches/gc/hdrs/flags.h

    r950 r1023  
    182182 
    183183 
    184 /* Flags can be in the flaglist multiple times, thanks to aliases. Keep 
    185    a reference count of how many times, and free memory when it goes to 0. */ 
    186 #define F_REF_MASK      0xFF000000U /**< Mask to get the reference count */ 
    187 #define F_REF_NOT       0x00FFFFFFU /**< Everything but */ 
    188 #define FLAG_REF(r)     (((r) & F_REF_MASK) >> 30) 
    189 #define ZERO_FLAG_REF(r) ((r) & F_REF_NOT) 
    190 #define INCR_FLAG_REF(r) ((r) + (1 << 30)) 
    191 #define DECR_FLAG_REF(r) ((r) - (1 << 30)) 
    192  
    193  
    194184/*-------------------------------------------------------------------------- 
    195185 * Powers table 
  • 1.8.3/branches/gc/hdrs/mymalloc.h

    r974 r1023  
    88#include "options.h" 
    99 
    10 #if (MALLOC_PACKAGE == 1) 
    11 #define CSRI 
    12 #elif (MALLOC_PACKAGE == 2) 
    13 #include <stdlib.h> 
    14 #define CSRI 
    15 #define CSRI_TRACE 
    16 #define CSRI_PROFILESIZES 
    17 #define CSRI_DEBUG 
    18 #include "csrimalloc.h" 
    19 #endif 
     10/* GC functions */ 
     11#include <gc.h> 
    2012 
    2113typedef struct slab slab; 
  • 1.8.3/branches/gc/hdrs/switches.h

    r974 r1023  
    154154#define SWITCH_YES 151 
    155155#define SWITCH_ZONE 152 
    156 #endif                          /* SWITCHES_H */ 
     156#endif /* SWITCHES_H */ 
  • 1.8.3/branches/gc/options.h.dist

    r838 r1023  
    2525 
    2626/*---------------- Internals with many options ------------------------*/ 
    27  
    28 /* Malloc package options */ 
    29 /* malloc() is the routine that allocates memory while the MUSH is 
    30  * running. Because mallocs vary a lot from operating system to operating 
    31  * system, you can choose to use one of the mallocs we provide instead of 
    32  * your operating system's malloc.  
    33  * Set the value of MALLOC_PACKAGE  to one of these values: 
    34  *  0 -- Use my system's malloc. Required for Win32 systems. 
    35  *       Recommended for FreeBSD, Linux, Mac OS X/Darwin, and other OS's 
    36  *       where you think the malloc routines are efficient and debugged. 
    37  *       In other words, pretty much any fairly current OS releases. 
    38  *  1 -- Use the CSRI malloc package in normal mode. 
    39  *       Recomended for ancient OS releases. On anything modern, you'll want 
    40  *       the system malloc (Option 0).  
    41  *  2 -- Use the CSRI malloc package in debug mode.  
    42  *       Only use this if you're tracking down memory leaks. Don't use 
    43  *       for a production MUSH - it's slow. 
    44  *  3, 4, 5, 6 -- Same as 0, kept for compatibility.  
    45  */ 
    46 #define MALLOC_PACKAGE 0 
    4727 
    4828/* What type of attribute compression should the MUSH use? 
  • 1.8.3/branches/gc/src/Makefile.in

    r1019 r1023  
    1919    funmath.c funmisc.c funstr.c funtime.c funufun.c game.c help.c  \ 
    2020    htab.c ident.c local.c lock.c log.c look.c malias.c markup.c    \ 
    21     match.c memcheck.c move.c mycrypt.c mymalloc.c mysocket.c \ 
    22     myrlimit.c myssl.c notify.c parse.c pcre.c player.c plyrlist.c    \ 
    23     predicat.c privtab.c info_master.c ptab.c rob.c services.c    \ 
    24     set.c shs.c sig.c sort.c speech.c sql.c strdup.c strtree.c    \ 
    25     strutil.c tables.c timer.c unparse.c utils.c version.c wait.c \ 
    26     warnings.c wild.c wiz.c 
     21    match.c move.c mycrypt.c mymalloc.c mysocket.c myrlimit.c \ 
     22    myssl.c notify.c parse.c pcre.c player.c plyrlist.c predicat.c    \ 
     23    privtab.c info_master.c ptab.c rob.c services.c set.c shs.c   \ 
     24    sig.c sort.c speech.c sql.c strtree.c strutil.c tables.c  \ 
     25    timer.c unparse.c utils.c version.c wait.c warnings.c wild.c  \ 
     26    wiz.c 
    2727 
    2828 
     
    3434    funmath.o funmisc.o funstr.o funtime.o funufun.o game.o help.o  \ 
    3535    htab.o ident.o local.o lock.o log.o look.o malias.o markup.o    \ 
    36     match.o memcheck.o move.o mycrypt.o mymalloc.o mysocket.o \ 
    37     myrlimit.o myssl.o notify.o parse.o pcre.o player.o plyrlist.o    \ 
     36    match.o move.o mycrypt.o mymalloc.o mysocket.o myrlimit.o \ 
     37    myssl.o notify.o parse.o pcre.o player.o plyrlist.o       \ 
    3838    info_master.o predicat.o privtab.o ptab.o rob.o services.o  \ 
    39     set.o shs.o sig.o sort.o speech.o sql.o strdup.o strtree.o    \ 
    40     strutil.o tables.o timer.o unparse.o utils.o version.o wait.o \ 
    41     warnings.o wild.o wiz.o 
     39    set.o shs.o sig.o sort.o speech.o sql.o strtree.o strutil.o   \ 
     40    tables.o timer.o unparse.o utils.o version.o wait.o warnings.o    \ 
     41    wild.o wiz.o 
    4242 
    4343# This is a dummy target, in case you type 'make' in the source 
     
    5656# We recompile mysocket.c instead of reusing mysocket.o because we 
    5757# want to do some error handing differently for info_slave. 
    58 info_slave: info_slave.c ident.o strdup.o sig.o wait.o mysocket.c ../hdrs/lookup.h 
     58info_slave: info_slave.c ident.o sig.o wait.o mysocket.c ../hdrs/lookup.h 
    5959    @echo "Making info_slave." 
    6060    $(CC) $(CCFLAGS) -c info_slave.c 
    6161    $(CC) $(CCFLAGS) -DINFOSLAVE -o info_slave info_slave.o \ 
    62     ident.o strdup.o sig.o wait.o mysocket.c $(LDFLAGS) $(LIBS) 
    63  
    64 SSL_SLAVE_OBJS = strdup.o sig.o mymalloc.o mysocket.o myssl.o notify.o myrlimit.o strutil.o ident.o utils.o 
     62    ident.o sig.o wait.o mysocket.c $(LDFLAGS) $(LIBS) 
     63 
     64SSL_SLAVE_OBJS = sig.o mymalloc.o mysocket.o myssl.o notify.o myrlimit.o strutil.o ident.o utils.o 
    6565ssl_slave: ssl_slave.c $(SSL_SLAVE_OBJS) 
    6666    @echo "Making ssl_slave." 
     
    285285bsd.o: ../hdrs/mushtype.h 
    286286bsd.o: ../hdrs/htab.h 
    287 bsd.o: ../hdrs/wait.h 
    288287bsd.o: ../hdrs/externs.h 
    289288bsd.o: ../hdrs/compile.h 
     
    309308bsd.o: ../hdrs/mysocket.h 
    310309bsd.o: ../hdrs/ident.h 
     310bsd.o: ../hdrs/wait.h 
    311311bsd.o: ../hdrs/lookup.h 
    312312bsd.o: ../hdrs/strtree.h 
     
    477477conf.o: ../hdrs/help.h 
    478478conf.o: ../hdrs/function.h 
     479conf.o: ../hdrs/mymalloc.h 
    479480cque.o: ../hdrs/copyrite.h 
    480481cque.o: ../config.h 
     
    781782fundb.o: ../hdrs/attrib.h 
    782783fundb.o: ../hdrs/function.h 
     784fundb.o: ../hdrs/mymalloc.h 
    783785funlist.o: ../hdrs/copyrite.h 
    784786funlist.o: ../config.h 
     
    842844funmath.o: ../hdrs/sort.h 
    843845funmath.o: ../hdrs/parse.h 
     846funmath.o: ../hdrs/mymalloc.h 
    844847funmath.o: lmathtab.c 
    845848funmisc.o: ../hdrs/copyrite.h 
     
    869872funmisc.o: ../hdrs/game.h 
    870873funmisc.o: ../hdrs/attrib.h 
     874funmisc.o: ../hdrs/mymalloc.h 
    871875funmisc.o: ../hdrs/ansi.h 
    872876funstr.o: ../hdrs/copyrite.h 
     
    894898funstr.o: ../hdrs/boolexp.h 
    895899funstr.o: ../hdrs/sort.h 
     900funstr.o: ../hdrs/mymalloc.h 
    896901funtime.o: ../hdrs/copyrite.h 
    897902funtime.o: ../config.h 
     
    972977game.o: ../hdrs/wait.h 
    973978game.o: ../hdrs/ansi.h 
     979game.o: ../hdrs/mymalloc.h 
    974980help.o: ../config.h 
    975981help.o: ../hdrs/conf.h 
     
    10491055local.o: ../hdrs/command.h 
    10501056local.o: ../hdrs/switches.h 
     1057local.o: ../hdrs/lock.h 
     1058local.o: ../hdrs/boolexp.h 
    10511059lock.o: ../hdrs/copyrite.h 
    10521060lock.o: ../config.h 
     
    11181126look.o: ../hdrs/parse.h 
    11191127look.o: ../hdrs/privtab.h 
     1128look.o: ../hdrs/mymalloc.h 
    11201129look.o: ../hdrs/log.h 
    11211130malias.o: ../config.h 
     
    11831192match.o: ../hdrs/match.h 
    11841193match.o: ../hdrs/parse.h 
    1185 memcheck.o: ../config.h 
    1186 memcheck.o: ../hdrs/conf.h 
    1187 memcheck.o: ../hdrs/copyrite.h 
    1188 memcheck.o: ../options.h 
    1189 memcheck.o: ../hdrs/mushtype.h 
    1190 memcheck.o: ../hdrs/htab.h 
    1191 memcheck.o: ../hdrs/externs.h 
    1192 memcheck.o: ../hdrs/compile.h 
    1193 memcheck.o: ../hdrs/dbdefs.h 
    1194 memcheck.o: ../hdrs/mushdb.h 
    1195 memcheck.o: ../hdrs/flags.h 
    1196 memcheck.o: ../hdrs/ptab.h 
    1197 memcheck.o: ../hdrs/chunk.h 
    1198 memcheck.o: ../confmagic.h 
    1199 memcheck.o: ../hdrs/pcre.h 
    1200 memcheck.o: ../hdrs/mymalloc.h 
    1201 memcheck.o: ../hdrs/log.h 
     1194match.o: ../hdrs/mymalloc.h 
    12021195move.o: ../hdrs/copyrite.h 
    12031196move.o: ../config.h 
     
    13631356pcre.o: ../config.h 
    13641357pcre.o: ../hdrs/pcre.h 
     1358pcre.o: ../hdrs/mymalloc.h 
     1359pcre.o: ../options.h 
    13651360pcre.o: ../confmagic.h 
    13661361player.o: ../hdrs/copyrite.h 
     
    14791474ptab.o: ../confmagic.h 
    14801475ptab.o: ../hdrs/pcre.h 
     1476ptab.o: ../hdrs/mymalloc.h 
    14811477rob.o: ../config.h 
    14821478rob.o: ../hdrs/copyrite.h 
     
    15661562sort.o: ../hdrs/switches.h 
    15671563sort.o: ../hdrs/sort.h 
     1564sort.o: ../hdrs/mymalloc.h 
    15681565speech.o: ../hdrs/copyrite.h 
    15691566speech.o: ../config.h 
     
    15901587speech.o: ../hdrs/game.h 
    15911588speech.o: ../hdrs/sort.h 
     1589speech.o: ../hdrs/mymalloc.h 
    15921590sql.o: ../hdrs/copyrite.h 
    15931591sql.o: ../config.h 
     
    16111609sql.o: ../hdrs/function.h 
    16121610sql.o: ../hdrs/ansi.h 
    1613 strdup.o: ../config.h 
    1614 strdup.o: ../hdrs/conf.h 
    1615 strdup.o: ../hdrs/copyrite.h 
    1616 strdup.o: ../options.h 
    1617 strdup.o: ../hdrs/mushtype.h 
    1618 strdup.o: ../hdrs/htab.h 
    1619 strdup.o: ../hdrs/mymalloc.h 
    1620 strdup.o: ../confmagic.h 
    16211611strtree.o: ../hdrs/copyrite.h 
    16221612strtree.o: ../config.h 
     
    16341624strtree.o: ../confmagic.h 
    16351625strtree.o: ../hdrs/pcre.h 
     1626strtree.o: ../hdrs/mymalloc.h 
    16361627strtree.o: ../hdrs/strtree.h 
    16371628strutil.o: ../config.h 
     
    16811672timer.o: ../hdrs/parse.h 
    16821673timer.o: ../hdrs/attrib.h 
     1674timer.o: ../hdrs/mymalloc.h 
    16831675unparse.o: ../hdrs/copyrite.h 
    16841676unparse.o: ../config.h 
     
    17021694unparse.o: ../hdrs/pueblo.h 
    17031695unparse.o: ../hdrs/parse.h 
     1696unparse.o: ../hdrs/mymalloc.h 
    17041697utils.o: ../hdrs/copyrite.h 
    17051698utils.o: ../config.h 
  • 1.8.3/branches/gc/src/access.c

    r945 r1023  
    117117  (const char *host, const dbref who, const int can, const int cant, 
    118118   const char *comment); 
    119 static void free_access_list(void); 
    120119 
    121120static int 
     
    126125  struct access *tmp; 
    127126 
    128   tmp = (struct access *) mush_malloc(sizeof(struct access), "struct_access"); 
     127  tmp = GC_MALLOC(sizeof(struct access)); 
    129128  if (!tmp) 
    130129    return 0; 
     
    172171     * entries 
    173172     */ 
    174     free_access_list()
     173    access_top = NULL
    175174  } 
    176175  access_top = NULL; 
     
    501500  struct access *tmp; 
    502501 
    503   tmp = (struct access *) mush_malloc(sizeof(struct access), "struct_access"); 
     502  tmp = GC_MALLOC(sizeof(struct access)); 
    504503  if (!tmp) 
    505504    return 0; 
     
    564563    if (strcasecmp(pattern, ap->host) == 0) { 
    565564      n++; 
    566       mush_free(ap, "struct_access"); 
    567565      if (prev) 
    568566        prev->next = next; 
     
    576574 
    577575  return n; 
    578 } 
    579  
    580 /* Free the entire access list */ 
    581 static void 
    582 free_access_list(void) 
    583 { 
    584   struct access *ap, *next; 
    585   ap = access_top; 
    586   while (ap) { 
    587     next = ap->next; 
    588     mush_free((Malloc_t) ap, "struct_access"); 
    589     ap = next; 
    590   } 
    591   access_top = NULL; 
    592576} 
    593577 
  • 1.8.3/branches/gc/src/atr_tab.c

    r905 r1023  
    213213      return; 
    214214    } 
    215     AL_NAME(ap) = strdup(name); 
     215    AL_NAME(ap) = GC_STRDUP(name); 
    216216    ap->data = NULL_CHUNK_REFERENCE; 
    217217  } 
     
    311311  /* Ok, take it out and put it back under the new name */ 
    312312  ptab_delete(&ptab_attrib, old); 
    313   /*  This causes a slight memory leak if you rename an attribute 
    314      added via /access. But that doesn't happen often. Will fix 
    315      someday.  */ 
    316   AL_NAME(ap) = strdup(newname); 
     313  AL_NAME(ap) = GC_STRDUP(newname); 
    317314  ptab_insert_one(&ptab_attrib, newname, ap); 
    318315  notify_format(player, 
  • 1.8.3/branches/gc/src/attrib.c

    r967 r1023  
    556556        } 
    557557        root->data = chunk_create(t, u_strlen(t), 0); 
    558         free(t); 
    559558      } 
    560559    } else { 
     
    577576 
    578577    ptr->data = chunk_create(t, u_strlen(t), derefs); 
    579     free(t); 
    580578 
    581579    if (*s == '$') 
     
    654652            mush_panic(T("Unable to allocate memory in atr_add()!")); 
    655653          root->data = chunk_create(t, u_strlen(t), 0); 
    656           free(t); 
    657654        } 
    658655      } else 
     
    690687    } 
    691688    ptr->data = chunk_create(t, u_strlen(t), 0); 
    692     free(t); 
    693689 
    694690    if (*s == '$') 
     
    15421538  while (used_list) { 
    15431539    UsedAttr *temp = used_list->next; 
    1544     mush_free(used_list, "used_attr"); 
    15451540    used_list = temp; 
    15461541  } 
  • 1.8.3/branches/gc/src/boolexp.c

    r985 r1023  
    265265                                     const char *s) __attribute_malloc__; 
    266266    static void skip_whitespace(void); 
    267     static void free_bool(struct boolexp_node *b); 
    268267    static struct boolexp_node *test_atr(char *s, char c); 
    269268    static struct boolexp_node *parse_boolexp_R(void); 
     
    278277    static int check_attrib_lock(dbref player, dbref target, 
    279278                                 const char *atrname, const char *str); 
    280     static void free_boolexp_node(struct boolexp_node *b); 
    281279    static int gen_label_id(struct bvm_asm *a); 
    282280    static void append_insn(struct bvm_asm *a, bvm_opcode op, int arg, 
     
    292290    static void optimize_bvm_asm(struct bvm_asm *a); 
    293291    static boolexp emit_bytecode(struct bvm_asm *a, int derefs); 
    294     static void free_bvm_asm(struct bvm_asm *a); 
     292    static void free_bvm_asm(void); 
    295293#ifdef DEBUG_BYTECODE 
    296294    static int sizeof_boolexp_node(struct boolexp_node *b); 
     
    325323 
    326324  len = chunk_len(b); 
    327   bytecode = mush_malloc(len, "boolexp.bytecode"); 
     325  bytecode = GC_MALLOC_ATOMIC(len); 
    328326  chunk_fetch(b, bytecode, len); 
    329327  return bytecode; 
     
    611609            } 
    612610          } 
    613           free((Malloc_t) orig); 
    614611        } 
    615612        break; 
     
    622619    } 
    623620  done: 
    624     mush_free(bytecode, "boolexp.bytecode"); 
    625621    return r; 
    626622  } 
     
    824820  a->name = st_insert(strupper(name), &atr_names); 
    825821  if (!a->name) { 
    826     mush_free(a, "boolatr"); 
    827822    return NULL; 
    828823  } 
     
    849844 
    850845  return b; 
    851 } 
    852  
    853 /** Frees a boolexp node. 
    854  * \param b the boolexp_node to deallocate. 
    855  */ 
    856 static void 
    857 free_bool(struct boolexp_node *b) 
    858 { 
    859   mush_free(b, "boolexp.node"); 
    860 } 
    861  
    862 /** Free a boolexp ast node. 
    863  * This function frees a boolexp, including all subexpressions, 
    864  * recursively. 
    865  * \param b boolexp to free. 
    866  */ 
    867 static void 
    868 free_boolexp_node(struct boolexp_node *b) 
    869 { 
    870   if (b) { 
    871     switch (b->type) { 
    872     case BOOLEXP_AND: 
    873     case BOOLEXP_OR: 
    874       free_boolexp_node(b->data.sub.a); 
    875       free_boolexp_node(b->data.sub.b); 
    876       free_bool(b); 
    877       break; 
    878     case BOOLEXP_NOT: 
    879       free_boolexp_node(b->data.n); 
    880       free_bool(b); 
    881       break; 
    882     case BOOLEXP_CONST: 
    883     case BOOLEXP_CARRY: 
    884     case BOOLEXP_IS: 
    885     case BOOLEXP_OWNER: 
    886     case BOOLEXP_BOOL: 
    887       free_bool(b); 
    888       break; 
    889     case BOOLEXP_IND: 
    890       if (b->data.ind_lock) 
    891         st_delete(b->data.ind_lock, &lock_names); 
    892       free_bool(b); 
    893       break; 
    894     case BOOLEXP_ATR: 
    895     case BOOLEXP_EVAL: 
    896     case BOOLEXP_FLAG: 
    897       if (b->data.atr_lock) { 
    898         if (b->data.atr_lock->name) 
    899           st_delete(b->data.atr_lock->name, &atr_names); 
    900         mush_free((Malloc_t) b->data.atr_lock, "boolatr"); 
    901       } 
    902       free_bool(b); 
    903       break; 
    904     } 
    905   } 
    906846} 
    907847 
     
    979919    } else { 
    980920      /* Ooog. Dealing with a malformed lock in the database. */ 
    981       free_bool(b); 
    982921      return NULL; 
    983922    } 
     
    999938    if (b->thing == NOTHING) { 
    1000939      notify_format(parse_player, T("I don't see %s here."), tbuf1); 
    1001       free_bool(b); 
    1002940      return NULL; 
    1003941    } else if (b->thing == AMBIGUOUS) { 
    1004942      notify_format(parse_player, T("I don't know which %s you mean!"), tbuf1); 
    1005       free_bool(b); 
    1006943      return NULL; 
    1007944    } else { 
     
    1026963    skip_whitespace(); 
    1027964    if (b == NULL || *parsebuf++ != ')') { 
    1028       free_boolexp_node(b); 
    1029965      return NULL; 
    1030966    } else { 
     
    10761012    t = parse_boolexp_R(); 
    10771013    if (t == NULL) { 
    1078       free_boolexp_node(b2); 
    10791014      return NULL; 
    10801015    } else { 
    10811016      b2->thing = t->thing; 
    1082       free_boolexp_node(t); 
    10831017      return b2; 
    10841018    } 
     
    10991033    t = parse_boolexp_R(); 
    11001034    if (t == NULL) { 
    1101       free_boolexp_node(b2); 
    11021035      return NULL; 
    11031036    } else { 
    11041037      b2->thing = t->thing; 
    1105       free_boolexp_node(t); 
    11061038      return b2; 
    11071039    } 
     
    11221054    t = parse_boolexp_R(); 
    11231055    if (t == NULL) { 
    1124       free_boolexp_node(b2); 
    11251056      return NULL; 
    11261057    } else { 
    11271058      b2->thing = t->thing; 
    1128       free_boolexp_node(t); 
    11291059      return b2; 
    11301060    } 
     
    11451075    t = parse_boolexp_R(); 
    11461076    if (t == NULL) { 
    1147       free_boolexp_node(b2); 
    11481077      return NULL; 
    11491078    } 
    11501079    b2->thing = t->thing; 
    1151     free_boolexp_node(t); 
    11521080    if (*parsebuf == '/') { 
    11531081      char tbuf1[BUFFER_LEN], *p; 
     
    11661094      upcasestr(tbuf1); 
    11671095      if (!good_atr_name(tbuf1)) { 
    1168         free_boolexp_node(b2); 
    11691096        return NULL; 
    11701097      } 
    11711098      m = match_lock(tbuf1); 
    1172       b2->data.ind_lock = st_insert(m ? m : tbuf1, &lock_names); 
     1099      b2->data.ind_lock = GC_STRDUP(m ? m : tbuf1); 
    11731100    } else { 
    1174       b2->data.ind_lock = st_insert(parse_ltype, &lock_names); 
     1101      b2->data.ind_lock = GC_STRDUP(parse_ltype); 
    11751102    } 
    11761103    return b2; 
     
    11901117    b2->type = BOOLEXP_NOT; 
    11911118    if ((b2->data.n = parse_boolexp_F()) == NULL) { 
    1192       free_boolexp_node(b2); 
    11931119      return NULL; 
    11941120    } else 
     
    12151141      b2->data.sub.a = b; 
    12161142      if ((b2->data.sub.b = parse_boolexp_T()) == NULL) { 
    1217         free_boolexp_node(b2); 
    12181143        return NULL; 
    12191144      } else { 
     
    12421167      b2->data.sub.a = b; 
    12431168      if ((b2->data.sub.b = parse_boolexp_E()) == NULL) { 
    1244         free_boolexp_node(b2); 
    12451169        return NULL; 
    12461170      } else { 
     
    14411365 */ 
    14421366static void 
    1443 free_bvm_asm(struct bvm_asm *a) 
    1444 
    1445   struct bvm_strnode *s, *tmp2; 
    1446  
    1447   if (!a) 
    1448     return; 
    1449  
     1367free_bvm_asm(void) 
     1368
    14501369  slab_destroy(bvm_asmnode_slab); 
    14511370  bvm_asmnode_slab = NULL; 
    1452  
    1453   for (s = a->shead; s; s = tmp2) { 
    1454     tmp2 = s->next; 
    1455     mush_free(s->s, "bvm.string"); 
    1456     mush_free(s, "bvm.strnode"); 
    1457   } 
    1458   mush_free(a, "bvm.asm"); 
    14591371} 
    14601372 
     
    16481560 
    16491561  b = chunk_create(bytecode, len, derefs); 
    1650   mush_free(bytecode, "boolexp.bytecode"); 
    16511562  return b; 
    16521563} 
     
    16771588  bvasm = generate_bvm_asm(ast); 
    16781589  if (!bvasm) { 
    1679     free_boolexp_node(ast); 
    16801590    return TRUE_BOOLEXP; 
    16811591  } 
     
    16871597  print_bytecode(bytecode); 
    16881598#endif 
    1689   free_boolexp_node(ast); 
    1690   free_bvm_asm(bvasm); 
     1599  free_bvm_asm(); 
    16911600  return bytecode; 
    16921601} 
     
    17421651  *bp = '\0'; 
    17431652  restore_global_regs("check_attrib_lock_save", preserve); 
    1744   free(asave); 
    17451653 
    17461654  return !strcasecmp(buff, str); 
  • 1.8.3/branches/gc/src/bsd.c

    r1017 r1023  
    402402  bool detach_session = 1; 
    403403 
     404  GC_INIT(); 
     405  GC_enable_incremental(); 
     406 
    404407/* disallow running as root on unix. 
    405408 * This is done as early as possible, before translation is initialized. 
     
    11581161      safe_str(socket_ident, tbuf1, &bp); 
    11591162      safe_chr('@', tbuf1, &bp); 
    1160       free(socket_ident); 
    11611163    } 
    11621164  } 
  • 1.8.3/branches/gc/src/bufferq.c

    r905 r1023  
    123123  BUFFERQ *bq; 
    124124  int bytes = lines * (BUFFER_LEN + BUFFERQLINEOVERHEAD); 
    125   bq = mush_malloc(sizeof(BUFFERQ), "bufferq"); 
    126   bq->buffer = mush_malloc(bytes, "bufferq.buffer"); 
     125  bq = GC_MALLOC(sizeof(BUFFERQ)); 
     126  bq->buffer = GC_MALLOC_ATOMIC(bytes); 
    127127  *bq->buffer = '\0'; 
    128128  bq->buffer_end = bq->buffer; 
     
    171171  } 
    172172  bufflen = bq->buffer_end - bq->buffer; 
    173   newbuff = realloc(bq->buffer, bytes); 
     173  newbuff = GC_REALLOC(bq->buffer, bytes); 
    174174  if (newbuff) { 
    175175    bq->buffer = newbuff; 
  • 1.8.3/branches/gc/src/chunk.c

    r918 r1023  
    15191519      do_rawlog(LT_TRACE, "CHUNK: realloc()ing region array"); 
    15201520#endif 
    1521       regions = (Region *) realloc(regions, region_array_len * sizeof(Region)); 
     1521      regions = GC_REALLOC(regions, region_array_len * sizeof(Region)); 
    15221522      if (!regions) 
    15231523        mush_panic("chunk: region array realloc failure"); 
  • 1.8.3/branches/gc/src/command.c

    r964 r1023  
    18381838  if (!code) 
    18391839    return 1; 
    1840   add_check("hook.code"); 
    18411840 
    18421841  save_global_regs("run_hook", origregs); 
  • 1.8.3/branches/gc/src/comp_h.c

    r967 r1023  
    9595  /* Part 2 - Actually get around to compressing the data... */ 
    9696  p = (const unsigned char *) s; 
    97   b = buf = (unsigned char *) malloc(needed_length); 
     97  b = buf = GC_MALLOC_ATOMIC(needed_length); 
    9898  stage = 0; 
    9999  bits = 0; 
  • 1.8.3/branches/gc/src/comp_w.c

    r911 r1023  
    208208    return; 
    209209  } 
    210   words[i] = malloc(wordpos); 
     210  words[i] = GC_MALLOC_ATOMIC(wordpos); 
    211211 
    212212  if (!words[i]) 
  • 1.8.3/branches/gc/src/comp_w8.c

    r911 r1023  
    211211    return; 
    212212  } 
    213   words[i] = malloc(wordpos); 
     213  words[i] = GC_MALLOC_ATOMIC(wordpos); 
    214214 
    215215  if (!words[i]) 
  • 1.8.3/branches/gc/src/conf.c

    r945 r1023  
    3939#include "help.h" 
    4040#include "function.h" 
     41#include "mymalloc.h" 
    4142#include "confmagic.h" 
    4243 
  • 1.8.3/branches/gc/src/cque.c

    r963 r1023  
    183183free_qentry(BQUE *point) 
    184184{ 
    185   int a; 
    186   for (a = 0; a < 10; a++) 
    187     if (point->env[a]) { 
    188       mush_free((Malloc_t) point->env[a], "bqueue_env"); 
    189     } 
    190   for (a = 0; a < NUMQ; a++) 
    191     if (point->rval[a]) { 
    192       mush_free((Malloc_t) point->rval[a], "bqueue_rval"); 
    193     } 
    194   if (point->semattr) 
    195     mush_free((Malloc_t) point->semattr, "bqueue_semattr"); 
    196   if (point->comm) 
    197     mush_free((Malloc_t) point->comm, "bqueue_comm"); 
    198185  slab_free(bque_slab, point); 
    199186} 
     
    348335  } 
    349336  parse_que(executor, command, enactor); 
    350   free(start); 
    351337  return 1; 
    352338} 
  • 1.8.3/branches/gc/src/db.c

    r935 r1023  
    150150      while (db_top > db_size) 
    151151        db_size *= 2; 
    152       if ((db = (struct object *) 
    153           malloc(db_size * sizeof(struct object))) == NULL) { 
     152      if ((db = GC_MALLOC_IGNORE_OFF_PAGE(db_size * sizeof(struct object)))  
     153          == NULL) { 
    154154        do_rawlog(LT_ERR, "ERROR: out of memory while creating database!"); 
    155155        abort(); 
     
    162162        db_size *= 2; 
    163163      if ((newdb = (struct object *) 
    164            realloc(db, db_size * sizeof(struct object))) == NULL) { 
     164           GC_REALLOC(db, db_size * sizeof(struct object))) == NULL) { 
    165165        do_rawlog(LT_ERR, "ERROR: out of memory while extending database!"); 
    166166        abort(); 
     
    11521152    } 
    11531153 
    1154     free((char *) db); 
    11551154    db = NULL; 
    11561155    db_init = db_top = 0; 
     
    15211520          fix_free_list(); 
    15221521          dbck(); 
    1523           log_mem_check(); 
    15241522          return db_top; 
    15251523        } 
     
    15481546    DBF_NEW_STRINGS | DBF_TYPE_GARBAGE | DBF_SPLIT_IMMORTAL | DBF_NO_TEMPLE | 
    15491547    DBF_SPIFFY_LOCKS; 
    1550  
    1551   log_mem_check(); 
    15521548 
    15531549  loading_db = 1; 
     
    17871783          fix_free_list(); 
    17881784          dbck(); 
    1789           log_mem_check(); 
    17901785          return db_top; 
    17911786        }