Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: alan@nabeth.cxo.cpqcorp.net (Alan Rollow - Dr. File System's Home for Wayward Inodes.)
Subject: Re: Memory management
Date: Wed, 08 May 2002 16:38:15 GMT	[thread overview]
Message-ID: <XvcC8.26$Pl6.622626@cacnews.cac.cpqcorp.net> (raw)
In-Reply-To: 3CD8C6D5.E16B0FF2@ijs.si

In article <3CD8C6D5.E16B0FF2@ijs.si>, Miha Andrejasic <miha.andrejasic@ijs.si> 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)



  reply	other threads:[~2002-05-08 16:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-08  6:33 Memory management Miha Andrejasic
2002-05-08 16:38 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-14  5:00 Memory Management root
2000-11-16  4:25 ` Park, Byoung-Kyu
2000-11-17  2:07   ` Hugh Patrick
2000-11-17  5:00     ` Robert Mulley
2000-11-17  5:00       ` Hugh Patrick
2000-11-17  5:00 ` Nikola Milutinovic
2000-11-18  5:00   ` Hugh Patrick
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox