pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:22:   #include "time_stuff.h"   #include "constants.h"   #include "interpret.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.57 2000/04/22 18:48:57 mast Exp $"); + RCSID("$Id: gc.c,v 1.58 2000/05/02 23:28:45 neotron Exp $");      /* Run garbage collect approximate every time we have    * 20 percent of all arrays, objects and programs is    * garbage.    */      #define GC_CONST 20   #define MIN_ALLOC_THRESHOLD 1000   #define MAX_ALLOC_THRESHOLD 10000000   #define MULTIPLIER 0.9
pike.git/src/gc.c:781:    exit_gc();    Pike_in_gc=0;       destruct_objects_to_destruct();       objects_freed -= (double) num_objects;       tmp=(double)num_objects;    tmp=tmp * GC_CONST/100.0 * (objects_alloced+1.0) / (objects_freed+1.0);    -  if((int)tmp < alloc_threshold + num_allocs) -  { -  alloc_threshold=(int)tmp; -  }else{ -  alloc_threshold+=num_allocs; -  } +  if(alloc_threshold + num_allocs <= tmp) +  tmp = (double)(alloc_threshold + num_allocs);    -  if(alloc_threshold < MIN_ALLOC_THRESHOLD) -  alloc_threshold = MIN_ALLOC_THRESHOLD; -  if(alloc_threshold > MAX_ALLOC_THRESHOLD) -  alloc_threshold = MAX_ALLOC_THRESHOLD; +  if(tmp < MIN_ALLOC_THRESHOLD) +  tmp = (double)MIN_ALLOC_THRESHOLD; +  if(tmp > MAX_ALLOC_THRESHOLD) +  tmp = (double)MAX_ALLOC_THRESHOLD; +  +  alloc_threshold = (int)tmp; +     num_allocs=0;      #ifdef PIKE_DEBUG    if(t_flag)    fprintf(stderr,"done (freed %ld of %ld objects).\n",    (long)(tmp2-num_objects),(long)tmp2);   #endif      #ifdef ALWAYS_GC    ADD_GC_CALLBACK();