Re: Moving the struct instance heap space to mmap



On Thu, 2006-09-07 at 21:14 +0200, Philip Van Hoof wrote:

> The *new*/*extra* idea is to create a second index file which contains
> the offsets to the pointers in the camel summary file. Then mmap also
> that file. "Extra" because the idea will build on top of the existing

Ummm, but this won't reduce your working set by very much, will it?

I haven't looked at the details, but can't you just keep an array in
memory with pointers to the *start* of each summary block, and then
compute the other pointers on demand?

Sort of

gpointer *pointers_to_message_summaries;
gpointer base;

base = mmap ("summary");

pointers_to_message_summaries = g_new (gpointer, num_messages);

pointers_to_message_summaries[0] = base;
pointers_to_message_summaries[1] = ...;

and then a set of functions

gpointer
gimme_ptr_to_subject_for_message_number (int n)
{
   return pointers_to_message_summaries[n] + SUBJECT_OFFSET;
}

etc.  Then, instead of 120 bytes per message, you'd have just
sizeof(pointer) and a little more code to compute the offsets on demand.

  Federico




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