且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

释放内存映射内存

更新时间:2023-02-02 16:18:53

法拉盛与复垦,IYAM无关。它只是确保脏页都写了(我想你还是需要一个磁盘同​​步,以确保它实际上/命中磁盘/)。

Flushing has nothing to with reclamation, IYAM. It just makes sure dirty pages are written out (I think you still need a disk sync to make sure it actually /hit the disk/).

所以,你正在寻找一种方式来取消映射。

So, you're looking for a way to unmap.

也许你可以使用像

当然,在一个更​​便携的时尚,你可能只是侥幸取消映射和重映射。如果访问的是纺纱硬盘和保持整个重映射的顺序,有可能不是一个性能损失(有可能是虽然,如果内核prefetched到的madvise例如,由于数据()或Windows等价物)

Of course, in a more portable fashion, you might just get away with unmapping and remapping. If the access is to spinning HDD and remains sequential across remaps, there might not be a performance penalty (there might be though, if the kernel prefetched data e.g. due to madvise() or the windows equivalent thereof)