[erlang-questions] mmap file to binary
Julian Tibble
julian.tibble@REDACTED
Fri Apr 9 11:11:25 CEST 2010
> Indeed, you are right. Just need to look, how to change free() to munmap()
That's also how it is done in the Sun Java VM, but it can cause a really
annoying cross-platform problem [1].
The trouble is that on Windows a mapped file may not be deleted, but the
point in time at which a file is unmapped with this scheme is
non-deterministic because it relies on the garbage-collector. Thus,
there is no reliable way to delete a file after it's been mapped.
Obviously on a Unix-like OS, there is no problem with unlinking a file
that is in use, so everything works fine - but this can be even worse:
things work fine on the developer's machine but when they distribute the
software it breaks.
Julian
[1]: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154
More information about the erlang-questions
mailing list