Memory Mapped File Access

Andrei Alexandrescu SeeWebsiteForEmail at
Sat May 29 09:30:13 PDT 2010

On 05/29/2010 10:40 AM, Sean Kelly wrote:
> Robert Wrote:
>> Hi, has anyone played around with D and memory mapped files on
>> Windows / Linux?
>> A friend of mine and I want to use D to develop a D native
>> database-system. Yes, sounds crazy and it will take long and we
>> haven't done a lot yet. So don't expect anything to look at soon
>> :-)
> Andrei and I had talked a while back about adding memory-mapped file
> support to the GC and then it fell off the radar while we worked on
> other things.  I'll see if I can remember how it was to work.

The basic idea is that the only way to handle memory-mapped files safely 
is to let the garbage collector close them. This is because in any other 
case you'd have dangling pointers.

So the idea is that druntime should provide a safe means for mapping a 
file to memory and an unsafe means of closing a file. Safe code should 
be able to count on the garbage collector to close memory-mapped files 
that have no pointers referring to them.


More information about the Digitalmars-d mailing list