From: Bernard B. <be...@la...> - 2015-11-20 13:43:58
|
On 11/18/15 4:48 PM, Matthew Fluet wrote: > >> As I mentionned in my previous post, the application makes use of ffi, >> and allocates some storage in C using mmap. At first, I was suspecting >> a collision between the storage allocated in C and that allocated by mlton. >> But how this could happen ? > ... > Unfortunately, the semantics of mmap is that if there is already a > mapping at a given address, then that previous mapping is removed and > a new one created. So, if MLton's sweep of high/low addresses happens > to hit upon the same address returned by a previous mmap, then it > might take that as an ML heap. But, I've never seen this happen. > But, I guess that we could look more closely at the strace to see if > this is happening. According to the mmap man page, removal of an old mapping may only happen if flag MAP_FIXED was passed to mmap (or the analogue for mremap), what mlton does not seem to do. > Another possibility is if the application passes an ML pointer to C > code via the FFI, which is retained by the C code and then accessed > later (e.g., during a subsequent FFI call). Not the case. The application could call SML from C, but it does not in that particular run. I'll prepare asap a stripped version of my source code, for further investigations. Thanks for your help, Bernard. |