pike.git / src / constants.c

version» Context lines:

pike.git/src/constants.c:6:   #include "global.h"   #include "constants.h"   #include "macros.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "memory.h"   #include "interpret.h"      static struct hash_table *efun_hash = 0; + static INT32 num_callable=0;      struct efun *lookup_efun(struct pike_string *name)   {    struct hash_entry *h;       if(!efun_hash) return 0;    h=hash_lookup(efun_hash, name);    if(!h) return 0;    return BASEOF(h, efun, link);   }
pike.git/src/constants.c:56:      struct callable *make_callable(c_fun fun,    char *name,    char *type,    INT16 flags,    optimize_fun optimize,    docode_fun docode)   {    struct callable *f;    f=ALLOC_STRUCT(callable); +  num_callable++;    f->refs=1;    f->function=fun;    f->name=make_shared_string(name);    f->type=parse_type(type);    f->flags=flags;    f->docode=docode;    f->optimize=optimize;    return f;   }      void really_free_callable(struct callable *fun)   {    free_string(fun->type);    free_string(fun->name);    free((char *)fun); -  +  num_callable--;   }      void add_efun2(char *name,    c_fun fun,    char *type,    INT16 flags,    optimize_fun optimize,    docode_fun docode)   {    struct svalue s;
pike.git/src/constants.c:131:      void cleanup_added_efuns()   {    if(efun_hash)    {    free_hashtable(efun_hash,free_one_hashtable_entry);    efun_hash=0;    }      } +  + 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); + } +