with-foreign-object allocation question
"Madhu (as enometh at meer dot net)" <[email protected]> Fri, 10 Apr 2026 14:08:38 +0530 (IST)
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
I am trying to fix a lethal memory bug in
https://github.com/StjepanPoljak/musicli src/jack.c: (start-jack-callbacks)
where there is a call
(cffi:with-foreign-object (args '(:pointer (:struct jack-cb-args)))
... clobber 24 bytes == (sizeof (:struct jack-cb-args))
allocated at ARGS ...)
which should really read
(cffi:with-foreign-object '(:struct jack-cb-args) ...)
this reliably crashes other lisps, but not lwl 64 personal. what
could be the reason for this resiliance? macroexpansion on the
incorrect form shows
(fli:with-dynamic-foreign-objects nil
(let* ((#:size6844 8)
(args (fli:alloca :type :byte :nelems #:size6844)))
Which shows only 8 bytes being allocated. but are allocations aligned
at > 24byte offsets, so the memory corruption doesn't show up in
lispworks in this case?
-- Madhu
(project author bcc'd)
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html