Subject: Re: bug#6006: recent emacs binary size increase by 800KB

From: Dan Nicolaescu <[email-masked]>
Date: Thu, 22 Apr 2010 16:45:16 -0400

Stefan Monnier <[email-masked]> writes:

>> The "data" segment size has increased between the .2 and .3 version
>> by 800KB.
> [...]
>>             * loadup.el: Setup hash-cons for pure data.
>
> Yes, this patch makes Emacs use free up a fairly large hash-table just
> before dumping, so its image is larger, with a fair amount of memory
> that's not actually used (it's still allocated to the Emacs process but
> Emacs has it registered as "free for reuse").
>
> Some of that memory can be recovered by adjusting the size of the
> pure-space (since the patch reduces the pure-space usage but didn't
> reduce the redefined size of the pure space), but not all.
>
> This said, I don't think it's a real problem since that memory is not
> really wasted (it will be used when Emacs starts to allocate), other
> than on the disk.

Part of that memory will be read from the disk at start up....
What if you allocate the hash table with a bigger size when creating
it? and maybe prefill it too.  That way there's a higher chance that
the memory will be returned to the OS when freed...