August 10, 2013 Re: std.mmfile | ||||
---|---|---|---|---|
| ||||
On Wednesday, August 07, 2013 10:18:14 H. S. Teoh wrote:
> I'm looking into std.mmfile for one of my new D projects, and I'm concerned about its API: there is no way to explicit unmap the file?? The docs say it will be unmapped when deleted, but isn't the delete operator deprecated? And the GC does not guarantee class dtors will ever get called. So how would I control when the mmfile is unmapped??
>
> Currently I'm thinking of just using the C library mmap instead. :-(
MmFile really should be a reference-counted struct. It has no business being a class, and it wouldn't surprise me if it could use some other changes as well, but I haven't looked over it in detail. I've used it in a project or two, but it was for stuff like reading a h.264 file where you read it, operate on it, and exit, so I didn't care about stuff like unmapping. It may be that MmFile is mostly correct, or it may be that it needs a bigger overhaul of how it works. I don't know.
So, ideally, someone would take the time to rework std.mmfile, probably by creating something like MMFile (which arguably better follows the Phobos naming scheme anyway), which would be a reference-counted struct and contain whatever other changes it needed over MmFile, and then we could deprecate MmFile.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation