Memory leak on darwin x86

Bug #326238 reported by Upward Index
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

When executing the following code:

(defun foo (array x y) (aref array x y))

(let ((a (make-array '(128 128))))
  (dotimes (i 1000000)
    (handler-case
       (foo a -1 -1)
     (type-error () 0))))

Memory usage goes up quickly until exhausted. Follows a stream of mmap: Cannot allocate memory and sbcl finally crashes.

It repros on sbcl darwin x86 1.0.22.? 1.0.24.24 and 1.0.25.9. However the bug does not seem to affect linux builds.

Tags: os-darwin
Paul Khuong (pvk)
description: updated
Revision history for this message
Paul Khuong (pvk) wrote :

The leak comes from signal_emulation_wrapper in x86-64-darwin-os.c:199. The (posix) handler function does not always return. Since our stuff isn't allocated on the stack, it doesn't get freed implicitly by unwinds. We don't allocate on the stack like on other platforms to avoid confusing the debugger's backtrace logic. It might be preferable to make the backtracer smarter, or track SP/IP around foreign stack frames.

description: updated
description: updated
Changed in sbcl:
importance: Undecided → High
status: New → Confirmed
importance: High → Medium
Revision history for this message
Stas Boukarev (stassats) wrote :

Fixed in f723f68aa847501d7f30e1403f79a678f7da2fe2

Changed in sbcl:
status: Confirmed → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.