sync_server "memory leak" with giant new mailbox first sync

David Carter dpc22 at
Tue Sep 12 08:21:01 EDT 2006

On Sun, 10 Sep 2006, Wesley Craig wrote:

> My solution (such as it is) was to reduce the wasteful amount of space 
> sync_server was allocating per message:
> [...]
> The times-5 is completely gratuitous.  In fact the pre-allocation of any 
> memory for paths is wasteful, but I was not up for reengineering the memory 
> scheme in sync_server at the time.

This started out life as:

   sprintf(tmp, "%lu.", l->count);
   result->msg_path   = xmalloc(l->stage_dir_len+strlen(tmp)+2);

At around 35 bytes a shot, you get rather more of these to the MByte.

If I recall correctly, the "5 * (MAX_MAILBOX_PATH+1)" was put in to 
support partitions. A lookup table for partitions and two integers (one 
for the partition number, one of the message number on that partition) 
should be all that is needed to reconstruct the paths at a later date.

David Carter                             Email: David.Carter at
University Computing Service,            Phone: (01223) 334502
New Museums Site, Pembroke Street,       Fax:   (01223) 334679
Cambridge UK. CB2 3QH.

More information about the Info-cyrus mailing list