On Mon, 2012-06-18 at 14:14 +0200, robert.van.herk@serioustoys.com wrote:
But then I was thinking: this seems like such an obvious thing to do, that it is almost suspicious. Was there any reason for copying the file contents to main memory and then create a memory stream?
For instance, was the intention to have a non-mutable copy in memory, in case the backing file would be altered later on?
Yes, the concern is that the file could be changed or removed. We should test what native does here but it probably means that we need to create a stream on the file with a sharing mode that denies writing.
I guess if that's the case, I could just create a copy of the original file in a temp dir, and mark it as STGM_DELETEONRELEASE.
It would take a long time to copy such a large file.