Re: Mutt's RAM usage (was: IMAP server side search integration)
In the last episode (Sep 10), Vincent Lefevre said:
> On 2005-09-06 00:15:08 +0100, Paul Walker wrote:
> > On Tue, Sep 06, 2005 at 12:03:26AM +0100, Dickon Hood wrote:
> > > mutt's RAM usage is pretty good, TBH. screen(1) uses more RAM.
> >
> > It is good, but I've noticed that with 1.5.10 it seems to have a
> > tendency to drift upwards, which I don't think it used to do. This
> > mutt was only started yesterday, for example, and hasn't been used
> > for any particularly large emails, and it's already up to 12MB
> > resident (according to top). There aren't any particularly large
> > shared libraries, so the rest of it must be going *somewhere*...
>
> And concerning huge mailboxes: On my 38900-message mailbox (maildir
> format), Mutt takes 43 MB resident, i.e. about 1 KB per message. This
> seems to be quite a lot.
Considering that each message needs at least one each of struct
envelope, header, and body (256 bytes total), plus the headers To,
From, Subject, Message-ID, References, In-Reply-To (just listing the
ones that tend to be long), 1k per message doesn't seem out of line.
I'd estimate your post needs 800 bytes at minimum, and I'm not counting
malloc overhead since there are at least a dozen mallocs per message.
Sharing elements of the References list between messages would be the
greatest single win; your message's references line is 300 bytes all by
itself.
One possible optimization would be to use refcounted shared strings for
the header fields. That would really help large mailing lists where
there are relatively few authors compared to messages. The space
savings in collapsing identical To/CC, From, and especially Subject and
References would be immense.
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx