From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,fe272f0bd8014f86 X-Google-Attributes: gidfee84,public From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: malloc failed Date: 1999/06/04 Message-ID: <7j9l75$lal$1@nntpd.lkg.dec.com>#1/1 X-Deja-AN: 485920615 Distribution: world References: <3749DDD7.E9964607@interra.com> Organization: Digital Equipment Corporation Reply-To: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Newsgroups: comp.unix.osf.osf1 In article <3749DDD7.E9964607@interra.com>, Asif Khalil Ansari writes: >I am facing this problem on a DEC Alpha running DU 4.0. Whenever I load >a very large testcase running into upwards of 200 MB, in our tool, it >seems to use up all the memory and then crash. malloc fails when the >process memory utilization reaches around 140MB, as reported by ps. First, you really should be checking the status of malloc and gracefully coping with the condition, rather than letting use the NULL pointer that comes back when it fails to allocate memory... >This >is close to the amount of physical memory available on the machine. Swap >appears to be totally unused by this process as indicated by swapon -s, >which shows swap utilization hovering around 1-2% . Any pointers on what >I need to do to ensure swap space usage ? Digital UNIX (Tru64 UNIX and DEC OSF/1) has a variety of ways that the virtual memory of a process is limited. The three most frequently encountered are running out of page/swap space, reaching the process data size limit and reaching the process stack size limit. In your case I'd guess that the program has reach the data size limit. Without other tuning, the system maximum for the data size limit is 1 GB, but many shells set the limit to 128 MB. Since this about the place that your process is having malloc fail, that's probably the problem. Most shells have a built-in command to change the limit from the default up to the maximum; usually ulimit or limit. There are configuration parameters to control the maximum sizes for data and stack as well the default sizes. There is also an documentation CDROM that came with the distribution that has the system management documentation on it. One of the books should explain how to use sysconfig to raise the limit. >Could this be a problem with the way our tool is allocating memory ? As I mentioned before, the process core dump is probably the result of not dealing with a system call that has failed. The rest depends on outside features. >I am loath to believe that, as >the same tool works just fine with 128 MB of physical memory on a Sun >Sparc. running Solaris 5.5.1. They must have a higher data size limit, or someone figured out how to raise the maximum and/or default... > >Thanks! >-- Asif Ansari > >--------------------------------------------------------------------- >ASIF KHALIL ANSARI Interra, Inc. > -- Alan Rollow alan@nabeth.cxo.dec.com