CTM problem

Stephen Montgomery-Smith stephen at math.missouri.edu
Mon Jan 19 19:03:31 PST 2004


Peter Jeremy wrote:
> CTM seems to have died sometime after 2004-Jan-17 0055 UTC - the
> last delta mailed or available via FTP is cvs-cur.9944.gz
> 


I did some analysis of the problem.  It looks like there will need to be some 
rewriting of mkctm.c.  I could try to do it myself, but if someone else wants to 
do it, that would be better.  I have no idea how long it will take me to do.  In 
fact, I am not exactly sure what the problem is.  It is probably somehow related 
to the fact that mkctm needs to use about 200M of memory.

The problem is when mkctm is comparing the file ports/INDEX,v in the old and new 
directories.  These files are getting to about 60 to 70MB in size.  mkctm 
contains a function called Equ.  First Equ does a mmap to map each of the files 
to memory, so that it can compare them to see if they are the same size.  If 
they are different, Equ then attempts to use alloca to allocate memory of the 
same size as the larger of the two files (plus 2).  This memory is then used to 
store the output of "diff -n".  It is during this call to alloca that mkctm has 
a segmentation fault.

Thus the program needs to allocate about 3 times 60 or 70MB.  I am not at all 
familiar with how FreeBSD allocates memory.  I see from the man page that alloca 
gets its memory from the stack.  I am guessing that mmap gets its memory from 
the heap, but I am not sure.

I remember working with these kinds of problems before.  I know that there is a 
command to change how much space processes are allowed to use, but I don't 
remember the commands for this right now.  Maybe someone could remind me what 
they are, and in that case maybe just increasing the stack allowed by processes 
would fix the problem.

In any case, fixing this problem is definitely stretching my Unix/BSD knowledge, 
so any help I can get would be greatly appreciated.

Best, Stephen


More information about the ctm-users mailing list