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

13:   #include "interpret.h"      static struct hash_table *efun_hash = 0; + static INT32 num_callable=0;      struct efun *lookup_efun(struct pike_string *name)   {
63:   {    struct callable *f;    f=ALLOC_STRUCT(callable); +  num_callable++;    f->refs=1;    f->function=fun;    f->name=make_shared_string(name);
78:    free_string(fun->type);    free_string(fun->name);    free((char *)fun); +  num_callable--;   }      void add_efun2(char *name,
138:    }      } +  + void count_memory_in_constants(INT32 *num_, INT32 *size_) + { +  INT32 size=0, num=0; +  if(efun_hash) +  { +  size+=sizeof(struct hash_table) + +  efun_hash->mask*sizeof(struct hash_entry)+ +  efun_hash->entries*sizeof(struct efun); +  } +  *num_=num; +  *size_=size; + } +  + void count_memory_in_callables(INT32 *num_, INT32 *size_) + { +  *num_=num_callable; +  *size_=num_callable*sizeof(struct callable); + } +