Я - нуб-шутник, пытающийся выучить шепот с помощью sbcl v1.0.50.
Я пишу простой регистратор и сталкиваюсь с ошибкой памяти, которая
Я не понимаю, но, похоже, связано с тем, как я собираю
скрипт. Я свел это к следующему:
=== logger.lisp ===
(defparameter *log-stream* (open "/tmp/global-log"
:direction :output
:if-does-not-exist :create
:if-exists :append))
=== main.lisp ===
(load "logger.lisp")
(defun main ()
(format *log-stream* "Hello world~%"))
== compile.lisp ==
#! /usr/bin/sbcl --script
(load "main.lisp")
(save-lisp-and-die "program" :toplevel #'main :executable t)
При компиляции и запуске программы происходит сбой:
> ./compile.lisp
[undoing binding stack and other enclosing state... done]
[saving current Lisp image into foo:
writing 6352 bytes from the read-only space at 0x20000000
writing 4064 bytes from the static space at 0x20100000
writing 43057152 bytes from the dynamic space at 0x1000000000
> ./program
CORRUPTION WARNING in SBCL pid 21860(tid 140737353914112):
Memory fault at f6977000 (pc=0x1000036365, sp=0x7ffff6b7f8d0)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
unhandled SB-SYS:MEMORY-FAULT-ERROR in thread #<SB-THREAD:THREAD
"initial thread" RUNNING
{10029118D1}>:
Unhandled memory fault at #x7FFFF6977000.
0: (SB-DEBUG::MAP-BACKTRACE
#<CLOSURE (LAMBDA #) {100291A3C9}>
:START
0
:COUNT
128)
1: (BACKTRACE 128 #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDERR* {100001CEB1}>)
2: (SB-DEBUG::DEBUGGER-DISABLED-HOOK
#<SB-SYS:MEMORY-FAULT-ERROR {10029180E1}>
#<unavailable argument>)
3: (SB-DEBUG::RUN-HOOK
*INVOKE-DEBUGGER-HOOK*
#<SB-SYS:MEMORY-FAULT-ERROR {10029180E1}>)
4: (INVOKE-DEBUGGER #<SB-SYS:MEMORY-FAULT-ERROR {10029180E1}>)
5: (ERROR SB-SYS:MEMORY-FAULT-ERROR :ADDRESS 140737330507776)
6: (SB-SYS:MEMORY-FAULT-ERROR)
7: ("foreign function: #x4174A0")
8: ("foreign function: #x417580")
9: (SB-IMPL::OUTPUT-BYTES/UTF-8
#<SB-SYS:FD-STREAM for "file /tmp/global-log" {10001B8A81}>
"AAAA"
NIL
0
4)
10: (SB-IMPL::FD-SOUT
#<SB-SYS:FD-STREAM for "file /tmp/global-log" {10001B8A81}>
"AAAA"
0
4)
11: (SB-IMPL::%WRITE-STRING
"AAAA"
#<SB-SYS:FD-STREAM for "file /tmp/global-log" {10001B8A81}>
0
NIL)
12: ((LAMBDA (STREAM &OPTIONAL &REST SB-FORMAT::ARGS))
#<SB-SYS:FD-STREAM for "file /tmp/global-log" {10001B8A81}>)
13: (FORMAT
#<SB-SYS:FD-STREAM for "file /tmp/global-log" {10001B8A81}>
#<FUNCTION (LAMBDA #) {100002F6C9}>)
14: ((FLET #:WITHOUT-INTERRUPTS-BODY-[RESTART-LISP]30))
15: ((LABELS SB-IMPL::RESTART-LISP))
unhandled condition in --disable-debugger mode, quitting
Я некоторое время пытался понять, что происходит, но хм. Помогите
был бы оценен!
Anders