From owner-ctm-users@FreeBSD.ORG Mon Jan 19 23:23:09 2004 Return-Path: Delivered-To: ctm-users@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 250C616A4CF for ; Mon, 19 Jan 2004 23:23:09 -0800 (PST) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E52A43D3F for ; Mon, 19 Jan 2004 23:23:07 -0800 (PST) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])i0K7N5e3003850; Tue, 20 Jan 2004 18:23:05 +1100 (EST) (envelope-from jeremyp@cirb503493.alcatel.com.au) Received: (from jeremyp@localhost)i0K7N04T003849; Tue, 20 Jan 2004 18:23:00 +1100 (EST) (envelope-from jeremyp) Date: Tue, 20 Jan 2004 18:23:00 +1100 From: Peter Jeremy To: Stephen Montgomery-Smith Message-ID: <20040120072300.GA3244@cirb503493.alcatel.com.au> References: <20040119082251.GA2708@server.vk2pj.dyndns.org> <400C9A7C.1000508@math.missouri.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <400C9A7C.1000508@math.missouri.edu> User-Agent: Mutt/1.4.1i cc: ctm-users@freebsd.org Subject: Re: CTM problem X-BeenThere: ctm-users@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CTM User discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2004 07:23:09 -0000 Hi Stephen, On Mon, Jan 19, 2004 at 09:03:24PM -0600, Stephen Montgomery-Smith wrote: >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. alloca() does allocate from the stack. mmap() allocates virtual space but not from the heap. >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. You are thinking of either ulimit(1) or setrlimit(2). Unfortunately, this isn't going to be enough in this case. The default stack size is set to the maximum - 65536KB for the i386. To increase this, you will need to set kern.maxssiz at boot time. (Though you can reduce it via ulimit, setrlimit or /etc/login.conf). Add a line like "kern.maxssiz=131072" to /boot/loader.conf and reboot to double the default stack size. I presume the machine you're running mkctm on has plenty of RAM - from a quick look at the mkctm code, I wouldn't suggest running it in any less than 256MB RAM - preferably 512MB. Peter