Branch: Tag:

1998-03-03

1998-03-03 22:30:29 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

DEBUG_MALLOC now usable, only minor leaks in compiler left as far as I know

Rev: src/array.c:1.24
Rev: src/dmalloc.h:1.2
Rev: src/error.h:1.8
Rev: src/language.yacc:1.52
Rev: src/las.c:1.41
Rev: src/las.h:1.10
Rev: src/lex.c:1.37
Rev: src/main.c:1.29
Rev: src/modules/Gmp/mpz_glue.c:1.25
Rev: src/modules/Image/colortable.c:1.30
Rev: src/modules/Image/encodings/pnm.c:1.6
Rev: src/object.c:1.31
Rev: src/object.h:1.13
Rev: src/pike_memory.c:1.7
Rev: src/pike_types.c:1.29
Rev: src/stralloc.c:1.20
Rev: src/svalue.h:1.11
Rev: src/testsuite.in:1.64

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: main.c,v 1.28 1998/03/03 11:24:33 hubbe Exp $"); + RCSID("$Id: main.c,v 1.29 1998/03/03 22:30:23 hubbe Exp $");   #include "backend.h"   #include "module.h"   #include "object.h"
300:    do_gc();       cleanup_callbacks(); +  + #if defined(DEBUG) && defined(DEBUG_MALLOC) +  if(verbose_debug_exit) +  { +  INT32 num,size,recount=0; +  fprintf(stderr,"Exited normally, counting bytes.\n"); +  +  count_memory_in_arrays(&num, &size); +  if(num) +  { +  recount++; +  fprintf(stderr,"Arrays left: %d (%d bytes) (zapped)\n",num,size); +  } +     zap_all_arrays(); -  +  +  count_memory_in_mappings(&num, &size); +  if(num) +  { +  recount++; +  fprintf(stderr,"Mappings left: %d (%d bytes) (zapped)\n",num,size); +  } +     zap_all_mappings();    -  +  count_memory_in_multisets(&num, &size); +  if(num) +  fprintf(stderr,"Multisets left: %d (%d bytes)\n",num,size); +  +  +  if(recount) +  { +  fprintf(stderr,"Garbage collecting..\n"); +  do_gc(); +  +  count_memory_in_arrays(&num, &size); +  fprintf(stderr,"Arrays left: %d (%d bytes)\n",num,size); +  count_memory_in_mappings(&num, &size); +  fprintf(stderr,"Mappings left: %d (%d bytes)\n",num,size); +  count_memory_in_multisets(&num, &size); +  fprintf(stderr,"Multisets left: %d (%d bytes)\n",num,size); +  } +  +  +  count_memory_in_programs(&num, &size); +  if(num) +  fprintf(stderr,"Programs left: %d (%d bytes)\n",num,size); +  +  { +  struct program *p; +  for(p=first_program;p;p=p->next) +  { +  describe_something(p, T_PROGRAM); +  } +  } +  +  +  count_memory_in_objects(&num, &size); +  if(num) +  fprintf(stderr,"Objects left: %d (%d bytes)\n",num,size); +     cleanup_shared_string_table();    } -  + #endif +  zap_all_arrays(); +  zap_all_mappings();    -  +  cleanup_shared_string_table(); + } +