[racket-dev] Windows ffi's 'malloc raw' can't be paired with C 'free'
At Tue, 18 Oct 2011 15:27:28 -0700, John Clements wrote:
> It looks like there's a problem with the ffi implementation of (malloc ...
> 'raw) in Windows. In particular, if I call 'free()' in a C extension on a
> block of memory that was allocated with (malloc ... 'raw), I get the Windows
> equivalent of a core dump, with an exception code that indicates "heap
> corruption".
The problem is that Racket and the extension are linked to different C
libraries, so you can use `malloc' from Racket only with `free' from
Racket.
The options for getting everything to use the same C library are not
pleasant. See
http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/
for a taste of the problem.