[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-devel
Subject:    Re: [Sbcl-devel] Leaky EQL-specialization
From:       Stig Hemmer <stighemmer () gmail ! com>
Date:       2010-07-30 16:02:25
Message-ID: AANLkTi=h1DL+4epqb5pUQWQH=BTuGVedfWjetkcNUunX () mail ! gmail ! com
[Download RAW message or body]

Nøstdals garbage generator:
: (defgeneric blah (x))
:
: (defun test ()
:  (let ((object (make-list 10000)))
:    (defmethod blah ((x (eql object)))
:      (format t "~A~%" x))
:    (sb-ext:finalize object (lambda ()
:                              (write-line "All Is Well!")))
:    (remove-method #'blah (first (sb-mop:generic-function-methods #'blah))))
:  (values))

I have a couple of nifty functions for finding leaks that others might
find useful:

(defvar *globals* nil)

(defun checkpoint ()
  (setf *globals* nil)
  (do-all-symbols (symbol)
    (when (boundp symbol)
      (let ((value (symbol-value symbol)))
	(when (hash-table-p value)
	  (push (cons symbol (hash-table-count value)) *globals*))))))

(defun compare ()
  (dolist (item *globals*)
    (when (/= (cdr item) (hash-table-count (symbol-value (car item))))
      (format t "~&~a: from ~a to ~a~&" (car item) (cdr item)
	      (hash-table-count (symbol-value (car item)))))))

According to these helpers, the following hash tables gain an entry
each when Nøstdals TEST function is called:
*EQL-SPECIALIZER-TABLE*
*EQL-SPECIALIZER-METHODS*
*EFFECTIVE-METHOD-CACHE*
These are all internal symbols in SB-PCL.

It looks to my untrained eye as if all these can be given key weakness
and the first can also be given value weakness.

After rebuilding with those changes, the effective method cache no
longer grows, but the other two do.

At this point I am out of ideas.

I have attached a patch with these weakenings, it is not enough but it
should be PART of a solution.

Stig Hemmer

["git-diff" (application/octet-stream)]

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm

_______________________________________________
Sbcl-devel mailing list
Sbcl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic