Branch: Tag:

1996-12-05

1996-12-05 00:47:58 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fixed a small memory leak and added _memory_usage

Rev: bin/test_pike.pike:1.3
Rev: src/ChangeLog:1.32
Rev: src/array.c:1.4
Rev: src/array.h:1.2
Rev: src/builtin_functions.c:1.16
Rev: src/builtin_functions.h:1.3
Rev: src/callback.c:1.4
Rev: src/callback.h:1.3
Rev: src/constants.c:1.4
Rev: src/constants.h:1.2
Rev: src/language.yacc:1.15
Rev: src/las.c:1.10
Rev: src/las.h:1.3
Rev: src/mapping.c:1.8
Rev: src/mapping.h:1.2
Rev: src/modules/call_out/call_out.c:1.4
Rev: src/modules/pipe/pipe.c:1.7
Rev: src/multiset.c:1.2
Rev: src/multiset.h:1.2
Rev: src/object.c:1.6
Rev: src/object.h:1.4
Rev: src/program.c:1.11
Rev: src/program.h:1.4
Rev: src/stralloc.c:1.8
Rev: src/stralloc.h:1.4

12:    int e, verbose, successes, errors, t, check;    string *tests;    program testprogram; -  int start, fail; +  int start, fail, mem; +  int loop=1;       for(e=1;e<argc;e++)    {
49:    fail+=arg;    break;    +  +  case "-l": +  case "--loop": +  loop+=arg; +  break; +     case "-t":    case "--trace":    t+=arg;
59:    check++;    break;    +  +  case "-m": +  case "--mem": +  case "--memory": +  mem++; +  break; +     default:    if(tests)    {
81:    }       tests=tests[0..sizeof(tests)-2]; +  +  while(loop--) +  { +  successes=errors=0; +     for(e=start;e<sizeof(tests);e++)    {    string test,condition;
211:       if(fail && errors)    exit(1); +  +  a=b=0;    }       if(errors + successes != sizeof(tests))
224:    perror("Failed tests: "+errors+".\n");    }    +  } +  if(mem) +  { +  int total; +  tests=0; +  gc(); +  mapping tmp=_memory_usage(); +  write(sprintf("%-10s: %6s %10s\n","Category","num","bytes")); +  foreach(sort(indices(tmp)),string foo) +  { +  if(sscanf(foo,"%s_bytes",foo)) +  { +  write(sprintf("%-10s: %6d %10d\n", +  foo+"s", +  tmp["num_"+foo+"s"], +  tmp[foo+"_bytes"])); +  total+=tmp[foo+"_bytes"]; +  } +  } +  write(sprintf("%-10s: %6s %10d\n", +  "Total", +  "", +  total)); +  } +     return errors;   }