[Antik-devel] Memory corruption when loading an SBCL core containing antik (patch included)

Liam Healy lhealy at common-lisp.net
Sat Dec 10 01:56:04 UTC 2011


On Fri, Dec 9, 2011 at 3:39 PM, James Wright <james at chumsley.org> wrote:

> Hi,
>
> When I dump an SBCL core from an image that has antik loaded, I get a
> memory corruption error when loading the core:
>  *** glibc detected *** sbcl: free(): invalid pointer: 0x0808d588 ***
> This happens even with a minimal project that does nothing but load
> antik; I've attached a script to reproduce the problem.
>
> I did some investigation, and it looks like the problem is the
> `*formatting-test-grid*' variable in `format-grid.lisp'.  It contains
> a list of grids, including some foreign arrays.  Presumably the
> foreign pointers in these arrays will be pointing to random/unowned
> memory when the core is loaded.  I've run into similar problems before
> in my own code (attempting to dump a global `*rng*' variable that
> contained a GSLL random number generator).
>
> I've attached a patch that replaces the problem `defparameter' form
> with a function instead.  I can't find any references to this variable
> in the source tree, so I assume it's just there for manual testing.
>
> Thanks,
>       James
>

Thanks James.  Indeed, *formatting-test-grid* is just a throwaway to test
the formatting of grids.  While a patch is OK, I would rather just not load
it.  However, I've long been uneasy with saved images and foreign memory; I
have no confidence that what's saved will come back.  Indeed, if you are
seeing rng variable problems, then there is a deeper problem that can't be
fixed with turning a defparameter into a function.  I would like to get
ideas from SBCL experts.   I think the solution is likely to be
implementation dependent, but that's the place to start.  Can you generate
a small example of your rng problem?

Liam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/antik-devel/attachments/20111209/fbc09dea/attachment.html>


More information about the antik-devel mailing list