Closed kkaefer closed 12 years ago
This patch breaks the anonymous mapping. If you use munmap/mmap on an mmaped file, thats fine. But this class also supports anonymous mapping and there you would loose the contents of the mmaped area on munmap. Mremap is actually needed here. We could break up the class into two classes so that we could at least support mmaped files on Darwin. But maybe there is a different way of doing the mremap() on Darwin that would be better? Splitting up Osmium::Storage::Mmap() into two classes would break lots of code using the Mmap class, so I don't want to do this if it is not necessary.
perhaps useful: http://dank.qemfd.net/bugzilla/show_bug.cgi?id=119
Wouldn't it hep to fallback to munmap/mmap for files and malloc/realloc fpr anonymous storage? Even under Unix I'm not sure what the benefit of using anonymous mmap vs. malloc is.
take a look at #44
Mac OS X doesn't support mremap() and I see no way around that without potentially using twice as much memory when copying data around. So I have re-factored the code into those bits thats work on Mac OSX and those that don't. Mac users just have to use those parts that work.
Compiling fails at https://github.com/joto/osmium/blob/master/include/osmium/storage/byid.hpp#L323 on Mac OS X (10.7) because Darwin doesn't have
mremap
.