From owner-freebsd-hackers  Mon Jan 17 18:32: 5 2000
Delivered-To: freebsd-hackers@freebsd.org
Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2])
	by hub.freebsd.org (Postfix) with ESMTP id 283ED14BD3
	for <hackers@FreeBSD.ORG>; Mon, 17 Jan 2000 18:32:03 -0800 (PST)
	(envelope-from dillon@apollo.backplane.com)
Received: (from dillon@localhost)
	by apollo.backplane.com (8.9.3/8.9.1) id SAA18439;
	Mon, 17 Jan 2000 18:31:47 -0800 (PST)
	(envelope-from dillon)
Date: Mon, 17 Jan 2000 18:31:47 -0800 (PST)
From: Matthew Dillon <dillon@apollo.backplane.com>
Message-Id: <200001180231.SAA18439@apollo.backplane.com>
To: Iani Brankov <ian@bulinfo.net>
Cc: hackers@FreeBSD.ORG
Subject: Re: The stack size for a process?
References:  <3883AC8A.7A6F7D5F@bulinfo.net>
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.ORG

:Hi,
:
:after making world of a CURRENT cvsupped yesterday, one of my
:applications stopped working because of a Segmentation fault.
:
:The C procedure where the problem pops has about 64k local variables.
:here's the assembly output of the procedure's beginning:
:
:0x805bb60 <transaction_read_objects>:   pushl  %ebp
:0x805bb61 <transaction_read_objects+1>: movl   %esp,%ebp
:0x805bb63 <transaction_read_objects+3>: subl   $0x1000c,%esp
:0x805bb69 <transaction_read_objects+9>: pushl  %edi
:
:
:The Segmentation fault happens when the process tries to push %edi in
:the stack, which has been just decreased by 0x1000c.
:
:here's the stack in the beginning of main():
:esp            0xbfbfd744
:ss             0x27
:
:and after the fault:
:esp            0xbfacae68
:ss             0x27
:
:If I decrease the size of the local vars, it goes ok.
:
:It's interesting, because I made a simple test using 640k local vars,
:and it worked!
:
:void ab() {
:        char buf[655360];
:        buf[0] = 0;
:	buff[655359] = 0;
:}
:
:main () {
:        ab();
:}
:
:
:--iani

    At your csh prompt type 'limit'.  If you are using bash type 'ulimit -a'.

    When I compile and run your program it works fine on my box.  I tried
    compiling it -O0, -O1, and -O2.

    % cc x.c -o x -O0
    % ./x
    %

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message