From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jaleel Ahmed Newsgroups: gmane.os.tru64.managers Subject: Summary: memory available to a process Date: Thu, 27 Jun 2002 02:00:13 -0700 (PDT) Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <20020627090013.84841.qmail@web13901.mail.yahoo.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1025168418 31878 127.0.0.1 (27 Jun 2002 09:00:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 27 Jun 2002 09:00:18 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.20.101]) by main.gmane.org with smtp (Exim 3.33 #1 (Debian)) id 17NV8T-0008I2-00 for ; Thu, 27 Jun 2002 11:00:17 +0200 Original-Received: (qmail 4033 invoked by uid 5); 27 Jun 2002 09:00:31 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 4025 invoked from network); 27 Jun 2002 09:00:30 -0000 Original-Received: from unknown (HELO emroute2.cind.ornl.gov) (128.219.159.41) by 0 with SMTP; 27 Jun 2002 09:00:30 -0000 Original-Received: from emroute2.cind.ornl.gov (LOCALHOST [127.0.0.1]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0GYC006XIX0J32@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 27 Jun 2002 05:00:30 -0400 (EDT) Original-Received: from web13901.mail.yahoo.com (web13901.mail.yahoo.com [216.136.175.27]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #39060) with SMTP id <0GYC00BB7X0GCP@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 27 Jun 2002 05:00:17 -0400 (EDT) Original-Received: from [202.54.32.161] by web13901.mail.yahoo.com via HTTP; Thu, 27 Jun 2002 02:00:13 -0700 (PDT) Original-To: 'tru64unix Xref: main.gmane.org gmane.os.tru64.managers:720 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:720 Hi Admins Thanks to all who replied. I must have done some homework before asking this ques. It seems this question has been already asked and answered on this list.I am posting the most comprehensive one of all replies. Fred Cassirer Wrote.... Absolutely! This is a direct result of the amount of physically memory and swap space allocated on your system and your current user limits settings (ulimit). To know how much space you have run swapon -s: bash-2.01$ swapon -s Swap partition /dev/disk/dsk9b (default swap): Allocated space: 50079 pages (391MB) In-use space: 7256 pages ( 14%) Free space: 42823 pages ( 85%) Swap partition /dev/disk/dsk3b: Allocated space: 150928 pages (1.15GB) In-use space: 6952 pages ( 4%) Free space: 143976 pages ( 95%) Total swap allocation: Allocated space: 201007 pages (1.53GB) Reserved space: 57288 pages ( 28%) In-use space: 14208 pages ( 7%) Available space: 143719 pages ( 71%) In this example above there are 2 swap partitions for a total of 1.53GB. Every time you do a malloc() (or calloc() etc) the system will "reserve" space for your allocation, this basically means if you malloc(10MB) then 10MB comes off the available swap allocation. Even if you don't touch this memory it will still be reserved. Once you touch it (i.e., array=malloc(10MB); array[1] = 1;) the system now has to make sure there is a physical page to put the data in and a place on swap to write it out to if the system needs the physical page back. Also, realize that even if you call free() this doesn't mean you actually return that space to the system, just to your program. The way it works is that when you call malloc() the C library in turn calls the "sbrk()" system call which requests that your program address space be increased by some amount. Once the address space is increased, swap space must be reserved by the system to insure that those pages, if used, will have some place to live. When you do a free(), you simply link the available address space back into a list within your own address space, it never does an "sbrk()" to *reduce* the space since that would require that the virtual space at the top of your data area to be free (you can't make holes in your address space). This means until you exit your program, that space is reserved for your program. In your example, you probably just caused sbrks() in 1MB increments (broken into pages). There are lots of papers around that describe this in much more detail. Now, since you were at 129, approx 128 MB's, I suspect instead of a system limit, you have hit a ulimit. Ulimit is a per-process limit for various resources, address space being one of them. I believe the default is 128MB: bash-2.01$ ulimit -a core file size (blocks) unlimited data seg size (kbytes) 131072 file size (blocks) unlimited max memory size (kbytes) 495856 open files 4096 pipe size (512 bytes) 8 stack size (kbytes) 8192 cpu time (seconds) unlimited max user processes 1024 virtual memory (kbytes) 4194304 Note that the data seg size is about 128MB, that is probably what you are hitting. man ulimit to see how to change these limits, you'll most likely have to put this ulimit call in your .profile and logout/login to have the limit change. -FredC ===== May Innocence and Joy Prevail __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com