Memory leak in REPL
Bug #936304 reported by
Andrei Dubovik
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
High
|
Unassigned |
Bug Description
I defined two functions (in REPL):
(defun test-gc ()
(let ((x (make-array 50000000 :initial-element 0)))
(elt x 0)))
(defun add-one (x) (+ 1 x))
Then, after repeating (add-one (test-gc)) a couple of times, I got a 'Heap exhausted' error. This happend in sbcl-1.0.54, and also in the today's git version (i.e. of 19.02.2012). So, the garbage collector does not free up the memory. Just to make sure I'm not missing something trivial, I also tried in clisp, there was no problem (except the maximum possible size of an array was smaller).
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I can confirm this happens on a Linux X64 box. Code used to test it:
(defun test-gc ()
(let ((x (make-array 50000000)))
(elt x 0)))
(defun add-one (x) (+ 1 x))
(time (handler-case
(add-one (test-gc)))
(print "PASSED"))
(sb-kernel: :heap-exhausted -error ()
(progn (loop repeat 100 do
(print "FAILED"))))
;;; starting git bisect with 5a6fd1bf1fa7d3c 71c9d5f603 b22071632e7278d 8f278b8fe3
;;; good: 823eef4db348c20
;;; bad: cb1734df0f1d211
;;; compilation failed for step before 0335fef2988e073 37ae8f1fc7, so I marked it as bad
;;; 2a9b33fc45842ec
Commit that seems to be the problem (this is my first use of git bisect, so take this with a grain of salt):
aadc8391153b7b9 39462752dfa3f8d ec49b2eba1 is the first bad commit 39462752dfa3f8d ec49b2eba1
commit aadc8391153b7b9
Author: Nikodemus Siivola <email address hidden>
Date: Mon Nov 21 16:53:17 2011 +0200
smaller default dynamic-space size on GENCGC
512Mb for 32-bit platforms, 1Gb for 64-bit ones.
(OpenBSD/ x86-64 is the exception using 444Mb to fit under default ulimits.)
:100644 100644 b1413abc9a27a02 3c6151c6cc6360e 8089d00761 31377099a17aad9 2153542e24620bd 44a05935f1 M INSTALL 339222e9acf554a 73936e0eea 5906f33e10b7ad3 b3d2b5823acb562 78c023393c M NEWS 95f7110cabce478 d77239f7c3 ae5b5a0eef2ddb0 42362376424a383 8fa7263432 M src
:100644 100644 b9fcd77355dac24
:040000 040000 26c72c7c9d8c3c1
Output of git bisect log:
git bisect start 05a6fd1bf1fa7d3 c71c9d5f603] 1.0: release, will be tagged as sbcl_1_0 5a6fd1bf1fa7d3c 71c9d5f603 1b22071632e7278 d8f278b8fe3] coreparse.c: Fix a typo WORD_FTMX -> WORD_FMTX. b22071632e7278d 8f278b8fe3 8d1cef8eb97de5f 577e30dd642] 1.0.28.12: preserve non-toplevelness of macro subforms d1cef8eb97de5f5 77e30dd642 5e7054ada13ef45 6e3dad08a34] 1.0.43.63: storing function documentation under names as well e7054ada13ef456 e3dad08a34 f8bc5a2e78a29d9 93f272d526e] sb-bsd-sockets: Fix error code handling on Windows 8bc5a2e78a29d99 3f272d526e 6f06f66baf17c3e 3e23c89575f] Make EXPT use double-precision throughout in more cases f06f66baf17c3e3 e23c89575f 474e35af14fb40d 9fa62843c79] Fix my previous commit on setf expansions. 74e35af14fb40d9 fa62843c79 d87fe0998f549e4 caaab4eed7b] NEWS prettification 87fe0998f549e4c aaab4eed7b 4b0d88bf9a69579 b7cddd80971] cleanup: use os_vm_size_t in npage_bytes b0d88bf9a69579b 7cddd80971 c0335fef2988e07 337ae8f1fc7] Fix errno value for sb-posix rmdir.error.3 test on OpenBSD. 0335fef2988e073 37ae8f1fc7 939462752dfa3f8 dec49b2eba1] smaller default dynamic-space size on GENCGC 39462752dfa3f8d ec49b2eba1
# good: [823eef4db348c2
git bisect good 823eef4db348c20
# bad: [cb1734df0f1d21
git bisect bad cb1734df0f1d211
# good: [ef5fdd6fc57729
git bisect good ef5fdd6fc577298
# good: [ce2a580a469d28
git bisect good ce2a580a469d285
# good: [7254da92a1ba1b
git bisect good 7254da92a1ba1bf
# good: [b90e13dea92ee6
git bisect good b90e13dea92ee66
# bad: [7df3c11a37f85e
git bisect bad 7df3c11a37f85e4
# bad: [4b93cd5bf1e3ce
git bisect bad 4b93cd5bf1e3ced
# bad: [6c0d91d49022c4
git bisect bad 6c0d91d49022c44
# bad: [2a9b33fc45842e
git bisect bad 2a9b33fc45842ec
# bad: [aadc8391153b7b
git bisect bad aadc8391153b7b9
# good: [f...