This project is read-only.

Deterministically closing memory mapped binary documents

Topics: PDB Reader, PDB Writer, PE reader, PE Writer
May 29, 2010 at 12:36 AM


How do I deterministically close all the memory mapped files that are used to read binary documents in CCI?



May 29, 2010 at 1:29 AM

I think I need to do some more work in this area. For now, you can avoid the problem by simply not using memory mapped files. You can do this by subclassing the base metadata host.

May 29, 2010 at 1:47 AM

Thanks for the answer, I'll try and do that.

May 29, 2010 at 1:05 PM
Edited Jun 1, 2010 at 5:26 PM

Yes, it works.

I implemented a IBinaryDocumentMemoryBlock that reads all the file in an unmanaged memory block at once, then I subclassed MetadataReaderHost, implementing the OpenBinaryDocument methods using that. It looks it's all is working fine.


Sep 24, 2010 at 11:21 PM

The MetadataReaderHost class now implements IDisposable and keeps track of all of the memory maps it allocates. If you call Dispose on the host, the maps will be closed.