From owner-freebsd-questions@FreeBSD.ORG Thu Feb 5 16:39:32 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 6202D16A4CE for ; Thu, 5 Feb 2004 16:39:32 -0800 (PST) Received: from gscamnlm01.wr.usgs.gov (gscamnlm01.wr.usgs.gov [130.118.4.111]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77E4743D54 for ; Thu, 5 Feb 2004 16:39:26 -0800 (PST) (envelope-from bundock@usgs.gov) To: freebsd-questions@FreeBSD.ORG X-Mailer: Lotus Notes Release 5.0.1b September 30, 1999 Message-ID: From: "Howard G Bundock" Date: Thu, 5 Feb 2004 16:39:25 -0800 X-MIMETrack: Serialize by Router on gscamnlm01/SERVER/USGS/DOI(Release 5.0.12HF345 | August 14, 2003) at 02/05/2004 04:39:26 PM, Serialize complete at 02/05/2004 04:39:26 PM MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: FreeBSD 4.9 on i386, using Generic Mapping Tools, calloc 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: Fri, 06 Feb 2004 00:39:32 -0000 I think I'm on the right track with trying to increase the "dat seg size" with ulimit. But even as root, I cannot increase the size of the data segment above 262144 kbytes. $ ulimit -a cpu time (seconds, -t) unlimited file size (512-blocks, -f) unlimited data seg size (kbytes, -d) 262144 stack size (kbytes, -s) 65536 core file size (512-blocks, -c) unlimited max memory size (kbytes, -m) unlimited locked memory (kbytes, -l) unlimited max user processes (-u) 5547 open files (-n) 11095 virtual mem size (kbytes, -v) unlimited sbsize (bytes, -b) unlimited $ ulimit -d 524288 $ulimit -a cpu time (seconds, -t) unlimited file size (512-blocks, -f) unlimited data seg size (kbytes, -d) 262144 stack size (kbytes, -s) 65536 core file size (512-blocks, -c) unlimited max memory size (kbytes, -m) unlimited locked memory (kbytes, -l) unlimited max user processes (-u) 5547 open files (-n) 11095 virtual mem size (kbytes, -v) unlimited sbsize (bytes, -b) unlimited Is some sysctl parameter sitting on this? Previous question -------------- I am running GMT on a FreeBSD i386 with 2GB physical memory and 6GB total swap space. Queries to the system show that I am truly running with that amount of memory (sysctl hw.physmem and top to see swap space.) My GMT script bombs when the grdproject program tries to allocate less than 100MB of memory (23049601 x 4bytes)! Even if I am forgetting about something in this calculation, it is 20 times less memory than what exists on the system, NOT INCLUDING SWAP! Is there a sysctl variable that I need to adjust, like a vm.??? or vfs.??? Is "calloc" the problem? I'm stumped. GMT code that is running when Fatal Error occurs - This is a routine, gmt_support.c, that is used by many of the GMT programs. void *GMT_memory (void *prev_addr, size_t nelem, size_t size, char *progname) { void *tmp; if (nelem == 0) return(VNULL); /* Take care of n = 0 */ if (prev_addr) { if ((tmp = realloc ((void *) prev_addr, (size_t)(nelem * size))) == VNULL) { fprintf (stderr, "GMT Fatal Error: %s could not reallocate more memory, n = %d\n", progname, nel em); exit (EXIT_FAILURE); } } else { if ((tmp = calloc ((size_t) nelem, (unsigned) size)) == VNULL) { fprintf (stderr, "GMT Fatal Error: %s could not allocate memory, n = %d, %d\n", progname, nelem, size); exit (EXIT_FAILURE); } } return (tmp); } Fatal Error - $cal_neva.script grdimage: Allocates memory and read data file grdimage: Allocates memory and read intensity file grdimage: project grdfiles grdimage: New grid size (nx,ny) 4801 by 4801 GMT Fatal Error: grdproject could not allocate memory, n = 23049601, 4 man page for calloc - The calloc() function allocates space for number objects, each size bytes in length. The result is identical to calling malloc() with an argument of ``number * size'', with the exception that the allocated memory is explicitly initialized to zero bytes. Howard Bundock U. S. Geological Survey Earthquake Hazards Team 345 Middlefield Road, MS977 Menlo Park, CA 94025 phone (650) 329-5621 FAX (650) 329-4732 bundock@usgs.gov