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.36 1998/04/24 00:32:08 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.37 1998/04/29 02:45:21 hubbe 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   #define MARKER_CHUNK_SIZE 1023      INT32 num_objects =0;   INT32 num_allocs =0;   INT32 alloc_threshold = MIN_ALLOC_THRESHOLD;   static int in_gc = 0; -  + struct queue gc_mark_queue;      static double objects_alloced = 0.0;   static double objects_freed = 0.0;      struct callback_list gc_callbacks;      struct callback *add_gc_callback(callback_func call,    void *arg,    callback_func free_func)   {
pike.git/src/gc.c:602:    /* 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();    call_callback(& gc_callbacks, (void *)0);       /* Next we mark anything with external references */    gc_mark_all_arrays(); +  run_queue(&gc_mark_queue);    gc_mark_all_multisets(); -  +  run_queue(&gc_mark_queue);    gc_mark_all_mappings(); -  +  run_queue(&gc_mark_queue);    gc_mark_all_programs(); -  +  run_queue(&gc_mark_queue);    gc_mark_all_objects(); -  +  run_queue(&gc_mark_queue);       if(d_flag)    gc_mark_all_strings();       /* Now we free the unused stuff */    gc_free_all_unreferenced_arrays();    gc_free_all_unreferenced_multisets();    gc_free_all_unreferenced_mappings();    gc_free_all_unreferenced_programs();    gc_free_all_unreferenced_objects();