From owner-freebsd-questions@FreeBSD.ORG Thu May 6 12:11:56 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4674716A4CE for ; Thu, 6 May 2004 12:11:56 -0700 (PDT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21C4743D46 for ; Thu, 6 May 2004 12:11:56 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin07-en2 [10.13.10.152]) by smtpout.mac.com (8.12.6/MantshX 2.0) with ESMTP id i46JBt7R020174; Thu, 6 May 2004 12:11:55 -0700 (PDT) Received: from [10.1.1.193] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)i46JBs4u007089; Thu, 6 May 2004 12:11:55 -0700 (PDT) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <394D439E-9F91-11D8-8290-003065ABFD92@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Thu, 6 May 2004 15:11:48 -0400 To: Caroline Korves X-Mailer: Apple Mail (2.613) cc: freebsd-questions@freebsd.org Subject: Re: segmentation fault-- is my array too long? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2004 19:11:56 -0000 This doesn't have much to do with FreeBSD, but... On May 6, 2004, at 2:58 PM, Caroline Korves wrote: > Any idea on what I should change to make the program run with large > numbers of elements in my arrays? Automatic variables get allocated from the stack, which can only grow to handle 8 MB or so by default. If you dynamicly allocate these arrays using malloc(), or else add the "static" keyword before the following declarations, you can probably increase the size of persons by a factor of 10 or more: > double ncost[persons][scens]; > double nuts[persons][scens]; -- -Chuck