pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:18:   #include "error.h"   #include "pike_memory.h"   #include "pike_macros.h"   #include "pike_types.h"   #include "time_stuff.h"      #include "gc.h"   #include "main.h"   #include <math.h>    - RCSID("$Id: gc.c,v 1.40 1998/12/16 07:49:35 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.41 2000/05/02 09:29:09 noring 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:648:       exit_gc();       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();   #else    if(d_flag > 3) ADD_GC_CALLBACK();   #endif    in_gc=0;   }