Scbl exception Heap consumed during garbage collection

When our application starts for a while, for example, it starts in a few hours, the sbcl command will throw a heap exception.

Heap exhausted during garbage collection: 1968 bytes available, 2128 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 5368709 0 0 0.0000 1: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000 2: 0 0 0 0 0 0 0 0 0 0 0 5368709 0 0 0.0000 3: 101912 101913 0 0 19362 20536 0 0 0 162867456 554752 102714709 0 1 1.4405 4: 130984 131071 0 0 29240 18868 0 0 25 191196152 5854216 128537781 14785 1 0.6442 5: 75511 81013 0 0 16567 17127 92 99 36 132974568 5818392 2000000 16565 0 0.0000 6: 0 0 0 0 7949 1232 0 0 0 37605376 0 2000000 7766 0 0.0000 Total bytes allocated = 524643552 Dynamic-space-size bytes = 536870912 GC control variables: *GC-INHIBIT* = true *GC-PENDING* = true *STOP-FOR-GC-PENDING* = false fatal error encountered in SBCL pid 3281(tid 3067845440): Heap exhausted, game over. Welcome to LDB, a low-level debugger for the Lisp runtime environment. ldb> 

Any suggestion?

+5
source share
1 answer

SBCL does not allow the allocation of more bytes (sb-ext:dynamic-space-size) on the heap. Here you have the default size of 512 MB (536870912 bytes), and Lisp already used almost the same amount when trying to make another allocation.

You can double the amount of heap space available for 1024 MB by running SBCL with -dynamic-space-size-1024. However, as pointed out in several comments, there may be a memory leak where the objects are referenced somehow proportionally to the time during which the system was started, so this will only offer a temporary delay.

The standard (room t) call to Common Lisp can help debug this if you call it periodically.

More advanced code is http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.debug;a=headblob;f=/source/path-to-root.lisp#l42 , which delves into the internal SB-VM distribution map can shed more light, and SBCL has a statistical profiler http://www.sbcl.org/manual/#Statistical-Profiler , which also supports distribution reports.

+1
source

All Articles