From a6308a4344c03f40edb3dc429c40c6bc54f76541 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Fri, 20 Dec 1991 18:25:28 +0000
Subject: [PATCH] When we reallocate vectors to grow them, clear the old vector
 so that it won't hold onto garbage (in case the vector was in static space,
 but pointed to dynamic values.)  This was a major cause of memory leakage in
 Hemlock.

---
 hemlock/table.lisp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hemlock/table.lisp b/hemlock/table.lisp
index d2a66b062..f21d6fdbc 100644
--- a/hemlock/table.lisp
+++ b/hemlock/table.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/table.lisp,v 1.1.1.4 1991/11/09 03:05:57 wlott Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/table.lisp,v 1.1.1.5 1991/12/20 18:25:28 ram Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -196,6 +196,9 @@
 ;;; of INSERT-ELEMENT must be used as a new vector may be created.
 ;;; (Note that the arguments should probably be lexicals since some of
 ;;; them are evaluated more than once.)
+;;;
+;;; We clear out the old vector so that it won't hold on to garbage if it
+;;; happens to be in static space.
 ;;; 
 (defmacro insert-element (vector pos element num &optional (grow-factor 2))
   `(let ((new-num (1+ ,num))
@@ -210,6 +213,7 @@
 	      (replace new ,vector :end1 ,pos :end2 ,pos)
 	      (replace new ,vector :start1 (1+ ,pos) :end1 new-num
 		       :start2 ,pos :end2 ,num)
+	      (fill ,vector nil)
 	      (setf (svref new ,pos) ,element)
 	      new))
 	   (t
-- 
GitLab