<div class="gmail_quote">On Fri, Dec 9, 2011 at 3:39 PM, James Wright <span dir="ltr"><<a href="mailto:james@chumsley.org">james@chumsley.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
When I dump an SBCL core from an image that has antik loaded, I get a<br>
memory corruption error when loading the core:<br>
*** glibc detected *** sbcl: free(): invalid pointer: 0x0808d588 ***<br>
This happens even with a minimal project that does nothing but load<br>
antik; I've attached a script to reproduce the problem.<br>
<br>
I did some investigation, and it looks like the problem is the<br>
`*formatting-test-grid*' variable in `format-grid.lisp'. It contains<br>
a list of grids, including some foreign arrays. Presumably the<br>
foreign pointers in these arrays will be pointing to random/unowned<br>
memory when the core is loaded. I've run into similar problems before<br>
in my own code (attempting to dump a global `*rng*' variable that<br>
contained a GSLL random number generator).<br>
<br>
I've attached a patch that replaces the problem `defparameter' form<br>
with a function instead. I can't find any references to this variable<br>
in the source tree, so I assume it's just there for manual testing.<br>
<br>
Thanks,<br>
<font color="#888888"> James</font><br></blockquote><div><br>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?<br>
<br>Liam<br></div></div>