On Mon, 2012-10-08 at 03:11 +0300, Timo Sirainen wrote:
The 3. part is what I like changing the least. An alternative solution would be to just not map the entire cache file into memory all at once. The code was actually originally designed to do just that, but munmap()ing + mmap()ing again wasn't very efficient. But for LMTP there's really no need to map the whole file. All it really wants is to read a couple of header records and then append to the file. Maybe it could use an alternative code path that would simply do that instead of mmap()ing anything. It wouldn't solve it for IMAP though.
Attached patch changes LMTP/LDA to not mmap() the target mailbox's cache file. I did a few quick tests and it seems to work. I'll probably commit it to 2.1 hg after some more tests.