[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] mmapping files into xstrings

From: Taylor R Campbell
Subject: [MIT-Scheme-devel] mmapping files into xstrings
Date: Sat, 15 Oct 2011 15:42:37 +0000
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.1

It's pretty silly that IMAIL copies the contents of file mailboxes
into memory, rather than mapping them.  When mailboxes start to grow
even to fairly small sizes (on the order of thousands of messages,
hundreds of megabytes), this wastes a lot of physical memory.  The
same applies to large Edwin buffers, although they're a little
fiddlier and would require more substantial changes, not to mention
that we have a 32 MB buffer limit anyway thanks to all the fixnum
arithmetic (grr).

I threw together a hack that will mmap(MAP_PRIVATE) the mailboxes into
memory instead, so that the physical memory can be shared, and backed
by the file rather than by swap.  (I really want MAP_COPY, but
apparently nobody has ever implemented that since Mach.  With any
luck, no other processes will modify those pages, so the difference
will be immaterial...)

The implementation -- diff attached -- is a nasty kludge and unfit to
be committed, but I don't have the time right now to engineer the
right thing.  Any thoughts on how the right interface to mmap ought to

Attachment: mmap-imail.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]