[climacs-cvs] CVS climacs

thenriksen thenriksen at common-lisp.net
Thu Dec 13 19:09:39 UTC 2007


Update of /project/climacs/cvsroot/climacs
In directory clnet:/tmp/cvs-serv28879

Modified Files:
	core.lisp 
Log Message:
Fixed memory creep issue.


--- /project/climacs/cvsroot/climacs/core.lisp	2007/12/12 23:44:42	1.18
+++ /project/climacs/cvsroot/climacs/core.lisp	2007/12/13 19:09:39	1.19
@@ -87,6 +87,11 @@
        (filepath (buffer view))
        (needs-saving (buffer view))))
 
+(defun dummy-buffer ()
+  "Create a dummy buffer object for use when killing views, to
+prevent increasing memory usage."
+  (make-instance 'drei-buffer))
+
 (defgeneric kill-view (view)
   (:documentation "Remove `view' from the Climacs specified in
 `*esa-instance*'. If `view' is currently displayed in a window,
@@ -106,6 +111,11 @@
                                   (return-from kill-view nil)))))
       (save-buffer (buffer view)))
     (setf views (remove view views))
+    ;; If we don't change the buffer of the view, a reference to the
+    ;; view will be kept in the buffer, and the view will thus not be
+    ;; garbage-collected. So create a circular reference structure
+    ;; that can be garbage-collected instead.
+    (setf (buffer view) (dummy-buffer))
     (full-redisplay (current-window))
     (current-view)))
 




More information about the Climacs-cvs mailing list