[rucksack-devel] Fwd: Re: [Sbcl-devel] Possibly memory leak

Arthur Lemmens alemmens at xs4all.nl
Fri Jan 12 13:38:10 UTC 2007


Cyrus,

Maybe using a two generation GC would be a good solution in your
case too?  I'd think that you want to have as little obsolete data
in memory as possible.

Arthur

------- Doorgestuurd bericht -------
Van: "Juho Snellman" <jsnell at iki.fi>
Aan: "Mika Pihlajamäki" <mika.pihlajamaki at selanpohja.fi>
Onderwerp: Re: [Sbcl-devel] Possibly memory leak
Datum: Fri, 12 Jan 2007 14:24:56 +0100

Mika Pihlajamäki <mika.pihlajamaki at selanpohja.fi> writes:
> This seems to reserve memory without releasing it to gc.
> (Using sbcl 1.0 in Linux x86 with 2GB ram)
>
> $ dd if=/dev/zero of=/tmp/10MB.txt bs=1M count=10
> $ sbcl
> * (defun file->list (filename)
>     (with-open-file (in filename :direction :input)
>       (loop for line = (read-line in nil nil)
>             while line ; not eof
>             collect line)))
>
> FILE->LIST
> * (loop for i from 1 do
>         (format t "~A0 MB~%" i)
>         (file->list "/tmp/10MB.txt"))
>
> Then after about 250 MB -> Heap exhausted. This terminates my program
> frequently as it uses strings and files a lot.

This particular example looks like a bad interaction between the
generational and conservative aspects of the GC. If it really is
representative of your program, doing the following would fix it:

  (define-alien-variable gencgc-oldest-gen-to-gc int)
  (setf gencgc-oldest-gen-to-gc 1)

This makes the GC function as a two-generation GC, rather than a
6-generation one, meaning that there will be fewer higher generations
holding onto obsolete data.






More information about the rucksack-devel mailing list