Memory Mapped File Access

Robert robert.muench at robertmuench.de
Sun May 30 02:02:45 PDT 2010


On 2010-05-29 21:58:59 +0200, Robert <robert.muench at robertmuench.de> said:

> This could become problematic if the app holds some slices to the MMF 
> and the 2nd open maps to a different memory address. In this case all 
> references to the MMF are invalid.

In this case a "core.exception.RangeError at ...: Range violation" is 
thrown. At least this makes it possible to identify illegal references.

> I saw that it's possible to specify an explicit address but it seems 
> not to be ensured that this address is used by the OS.
> 
> Going to do some tests to see if this holds or not. Returned values 
> from the MMF (even index offsets) of course stay the same and are valid.

Even if this is guaranteed it won't help, old references are invalid. 
Which is IMO a good thing.

So, conclusion: It's possible to close a MMF while there are still 
references to it. But, those references become invalid and throw an 
exception. Hence this situation can be identified and handled.

--
Robert M. Münch
http://www.robertmuench.de



More information about the Digitalmars-d mailing list