[MLton-user] Memory management C/SML

Alexandre Hamez alexandre.hamez at gmail.com
Thu Apr 28 02:40:30 PDT 2011


Hello,

	I've got the following use case: I'm generating a C library, for efficiency and space reasons, which is dynamically open by the SML part. This library can easily produce several GB of memory.
	My understanding of the MLton memory management is that a process memory is handled in a single contiguous block, and that when more memory is needed, the GC might copy the whole block, thus needing a bigger block of free memory. Thus, there might be conflicts between the C allocated memory and the SML one. I'm trying to allocate blocks (with mmap it that matters, but I could easily reverse to malloc) in a contiguous way to avoid fragmentation.
	In this context, are there good practices to manage memory on the C side?

---------------------
Alexandre Hamez










More information about the MLton-user mailing list