From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,f6bed2ebc8705462 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-05-08 09:33:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!cacnews.cac.cpqcorp.net!53ab2750!not-for-mail Newsgroups: comp.unix.tru64 From: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Distribution: world References: <3CD8C6D5.E16B0FF2@ijs.si> Reply-To: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: Memory management Message-ID: Date: Wed, 08 May 2002 16:38:15 GMT NNTP-Posting-Host: 16.112.5.128 X-Complaints-To: abuse@Compaq.com X-Trace: cacnews.cac.cpqcorp.net 1020875895 16.112.5.128 (Wed, 08 May 2002 09:38:15 PDT) NNTP-Posting-Date: Wed, 08 May 2002 09:38:15 PDT Organization: Hewlett-Packard Co. Xref: archiver1.google.com comp.unix.tru64:7524 In article <3CD8C6D5.E16B0FF2@ijs.si>, Miha Andrejasic writes: > >I have a question regarding memory on my computer. I have Digital PWS >433a with Tru64 5.1A. I also have 512MB of memory. > >I am having some problems with one of my programs. When I start the >program, it checks for available memory. It says that it requires at >least 256MB of memory. When the sistem is fresh everything is OK. But >when I close the program and start it again it says that there is no >more than 140MB of memory left. How is the program checking for the amount of memory "available"? Most modern computer systems use demand paged virtual memory. The amount of memory "available" is as large as you're willing to put up with the system paging. There are maximums enforced by architecture, system tuning parameters and available page/swap space, but within these limits you can always get the however much virtual memory that you want. Programs can check for the amount of free memory. This isn't a particularly reliable method for deciding that there is enough memory to run, since you are on a demand paged virtual memory system. Part of the problem using free memory as a guide is that the file system buffer cache can use nearly all available memory to cache file data. This tends to make free memory very fluid. You may not a appear to have much at some moment, but as soon your program needs pages, they can be reclaimed. >If I want to use program again I have to shutdown system and boot it up >again. >I was told that this is a problem with memory allocation and that this >allocated memory isn't freed after use or when the program closes. The symtom as described of often called a "memory leak". Certain applications have been known to have them, but any such problem in the operating system would have been fixed long ago. The memory allocation routine most commonly used by C programmers (malloc(3)) doesn't necessarily give virtual memory back to the system when freed. However, if the program is freeing the memory, then it will be available for later allocations. Some implementations can give memory back under the right circumstance. I don't recall if the Tru64 UNIX implementation is one of these. > >Is there anything I can do to free memory with software so I won't have >to reboot time after time just to use this program? As described, the problem you're having is not a problem that you should be having. As long as there's enough page/swap space you can always allocate more virtual memory. When the program exits, whatever virtual memory it had allocated should be given back. So, your program is doing something out of the ordinary. There are lots of ways to allocate memory. At least one of them is persistent. Is the program using shared memory? Is it memory mapping files? Does it start some other process to keep the memory around even after it exits? Is the program locking pages? I think there is a lot of you haven't said about this application. It may simply be that you don't know, but you should find out, since what you're seeing isn't typical. > >Thanx for your help. > >CCCao >-- >Miha Andrejasic > -- Alan Rollow alan@nabeth.cxo.cpqcorp.net (previously .dec.com)