[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

continual GCs

    Date: Thu, 7 Jul 88 11:08 EDT
    From: barmar@Think.COM (Barry Margolin)

	Date: Wed, 6 Jul 88 15:20:47 PDT

	Can anyone tell me why I get garbage collection happening when my 
	machine is not being used (all weekend). I could understand a few GCs
	after I stopped working just to catch up they seem to continue for days!
	The log shows something like 4 meg being "used"!

    If the garbage collection doesn't reclaim much virtual memory, another
    GC will be started almost immediately after the previous one finishes.
    It doesn't realize that hardly anything has been consed since the
    previous GC started; GC is simply triggered by the percentage of dynamic
    space that is allocated.

    Most of us here keep the Dynamic GC turned off.  Ephemeral GC gets most
    of the day-to-day garbage.  I use a GC Thermometer (I think a version of
    this is on SLUG Library Tape #3), and when I notice my memory filling up
    I do a "Start GC :Immediately" before going home that night.

    I once did try running with Dynamic GC turned on.  As soon as one GC
    finished it would start another, which made it really painful to use.  I
    sent a suggestion to Symbolics that dynamic GC's should be inhibited for
    some time after one finishes (the amount of time should be settable, of
    course), in order to give the user time to make garbage and to prevent
    such obvious thrashing.  While this could cause the machine to go past
    the point of a safe dynamic GC, I don't think it is a fatal flaw; an
    earlier GC would be unlikely to reclaim much, anyway.


I've been cheating worse than this for years.  I hate the GC interrupting me
when I need to use the mouse in real time.  So:

1.  I turn Dynamic GCs OFF and Ephemeral GCs ON.

2.  I have the following code in my init file that runs a GC-IMMEDIATELY every
    day at midnight.  When I come in the morning, the machine is emptied of
    garbage and ready to use.  Only two useless GCs are run Sat and Sun midnite.
    Simply logging out removes the timer queue.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Begin Inserted Lisp Code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

;;; ------------------------------------------------------------------------------------------
;;; Turn the GC off.  Then (if we haven't already done this as part of a previous login) set up a 
;;; timer queue entry to do an immediate GC every night at midnight.  

(sys:gc-on :ephemeral t :dynamic nil)

(unless (loop for entry being the heap-elements of si:*timer-queue*
	      thereis (string= (si:timer-queue-name entry) "Phantom Collector"))
  (push `(si:remove-timer-queue-entry
	   ,(si:add-timer-queue-entry (time:parse-universal-time "tomorrow at midnight")
				      '(:forever #.(* 24. 60. 60.)) "Phantom Collector"
				      #'process-run-function "Midnight Memory Sales"
				      #'si:gc-immediately t))


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> End Inserted Lisp Code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I have been using this code for over two years in Rel6.1, Genera7.1, and
Genera7.2 with no problems.  The only disadvantage occurs in the morning when a
large amount of paging may occur when I start using the machine.