pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:12:      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"   #include "program.h"   #include "stralloc.h"   #include "stuff.h"   #include "error.h"   #include "pike_memory.h" + #include "pike_macros.h"      #include "gc.h"   #include "main.h"      /* Run garbage collect approximate every time we have    * 20 percent of all arrays, objects and programs is    * garbage.    */      #define GC_CONST 20
pike.git/src/gc.c:244:    268435455, /* ~ 2^28 = 268435456 */    536870911, /* ~ 2^29 = 536870912 */    1073741823,/* ~ 2^30 = 1073741824 */    2147483647,/* ~ 2^31 = 2147483648 */   };      void do_gc(void)   {    static int in_gc = 0;    double tmp; -  INT32 tmp2; +  INT32 tmp2,tmp3;    struct marker_chunk *m;       if(in_gc) return;    in_gc=1;       if(gc_evaluator_callback)    {    remove_callback(gc_evaluator_callback);    gc_evaluator_callback=0;    }
pike.git/src/gc.c:275:    objects_alloced*=MULTIPLIER;    objects_alloced += (double) num_allocs;       objects_freed*=MULTIPLIER;    objects_freed += (double) num_objects;          /* init hash , hashsize will be a prime between num_objects/8 and    * num_objects/4, this will assure that no re-hashing is needed.    */ -  hashsize=my_log2(num_objects); +  tmp3=my_log2(num_objects);    -  if(!d_flag) hashsize-=2; +  if(!d_flag) tmp3-=2; +  if(tmp3<0) tmp3=0; +  if(tmp3>=(long)NELEM(hashprimes)) tmp3=NELEM(hashprimes)-1; +  hashsize=hashprimes[tmp3];    -  if(hashsize<0) hashsize=0; -  hashsize=hashprimes[hashsize]; +     hash=(struct marker **)xalloc(sizeof(struct marker **)*hashsize);    MEMSET((char *)hash,0,sizeof(struct marker **)*hashsize);    markers_left_in_chunk=0;       /* First we count internal references */    gc_check_all_arrays();    gc_check_all_multisets();    gc_check_all_mappings();    gc_check_all_programs();    gc_check_all_objects();