eql-specializer-objects are not freed (remove-method)

Bug #492851 reported by Rthaduthd Anthnhkrc on 2009-12-05
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

A quick test shows what this is about:

$ sbcl --dynamic-space-size 256 --no-userinit --no-sysinit
This is SBCL 1.0.33, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

* (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))

* (loop (test))

Heap exhausted during garbage collection: 0 bytes available, 16 requested.
 Gen StaPg UbSta LaSta LUbSt Boxed Unboxed LB LUB !move Alloc Waste Trig WP GCs Mem-age
   0: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   1: 62497 61768 0 0 24301 1 0 0 0 99521040 19952 61844048 0 1 1.4036
   2: 65535 0 0 0 30245 35 48 40 25 124268384 118944 2000000 21686 0 0.7161
   3: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   4: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   5: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   6: 0 0 0 0 9715 1151 0 0 0 44507136 0 2000000 9673 0 0.0000
   Total bytes allocated = 268296560
   Dynamic-space-size bytes = 268435456
GC control variables:
          *GC-INHIBIT* = true
          *GC-PENDING* = in progress
 *STOP-FOR-GC-PENDING* = false
fatal error encountered in SBCL pid 16481(tid 140737354004208):
Heap exhausted, game over.

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>

The call to sb-ext:finalize is not needed for this to happen btw..

Tags: pcl Edit Tag help

 status confirmed
 importance medium
 tag pcl

We should probably be interning EQL-SPECIALIZERS in a weak hash-table instead of a strong one...

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Stig Hemmer (stighemmer) wrote :

The attached patch weakens the relevant hash tables. It does not solve the problem, so there has to be some other stray reference somewhere.

Attila Lendvai (attila-lendvai) wrote :

last time we were struggling with memory leaks we developed some code to scan sbcl's heap and look for path'es to root objects starting from a given object.

i've run it on this example which you can find attached. didn't analyze the data much, but the obvious hashtables show up, and i guess the last big list is a method cache, but i leave it for people who understand sbcl internals more.

[...] represents one path
-> is one step in the path

hope it helps.

tags: added: review
Nikodemus Siivola (nikodemus) wrote :

Attached patch describes some work on this.

Not a complete solution yet, but I suspect I've identified the last leak: method function names in globaldb (aka INFO).

tags: removed: review
Irène Durand (idurand) wrote :

I obtain the same error
"heap exhausted during garbage collection"
running one of my programs on my MacBook Pro Darwin kernel Version 10.8.0
with SBCL 1.0.55.
The program use to work fine with previous versions od SBCL.

The same program runs fine on
Linux faucon 2.6.32-39-generic #86-Ubuntu SMP Mon Feb 13 21:50:08 UTC 2012 x86_64 GNU/Linux
SBCL 1.0.29.11.debian

I checked that on both machines the two SBCL use the same dynamic-space-size.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers