Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: john@iastate.edu (John Hascall)
Subject: Re: How do you release memory back to the kernel in C
Date: 1998/05/21	[thread overview]
Message-ID: <6k208g$ajq$1@news.iastate.edu> (raw)
In-Reply-To: 895607898snz@genesis.demon.co.uk


}In article <35616C36.9167165F@citicorp.com>
}           asgar.ali@citicorp.com "Asgar Ali" writes:
}>In DEC Unix (3.x and 4.x) I am finding that "free" does not release
}>memory back to the kernel so that it could be used by other processes.
}>This creates the problem that if several such processes are running each
}>needed a lot of memory at some time, none of them can share what the
}>others have used. Hence you run out of memory quickly.

From 'man malloc' (DU 4.0d):

  Tuning Memory Allocation

  The behavior of these memory allocation functions can be tuned to optimize
  their performance in a particular application.

  The following variables control how the functions operate.  Note that these
  variables and their effects are specific to the current DIGITAL UNIX memory
  allocation implementation.  The default values for these variables are
  specified by libc.  To specify values other than the defaults, create a
  module containing definitions for the complete set of variables and include
  that module in your compilation.  (If you define only some of these vari-
  ables, your compilation will produce "multiply defined" errors if you link
  the program nonshared.)  For each variable in this list, the default value
  is indicated after the equal sign.

  unsigned long __noshrink = 0
       The variable __noshrink controls management of the heap size (which in
       turn controls the size of the required swap area).  As the user makes
       calls to free() or realloc(), the memory associated with the call can
       be put back into the pool of free memory.  Permissible values for
       __noshrink are 0 and 1.

       If the memory that is freed resides at the end of the heap and meets
       the constraints of __minshrink and __minshrinkfactor, it can be
       returned to the kernel by sbrk(nnn) if __noshrink is 0.  If __noshrink
       is 1, no attempts are made to return the freed memory.

John
-- 
John Hascall, Software Engr.        Shut up, be happy.  The conveniences you
ISU Computation Center              demanded are now mandatory. -Jello Biafra
mailto:john@iastate.edu
http://www.cc.iastate.edu/staff/systems/john/welcome.html  <-- the usual crud



  reply	other threads:[~1998-05-21  4:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-19  4:00 How do you release memory back to the kernel in C Asgar Ali
1998-05-19  4:00 ` Kaz Kylheku
1998-05-20  4:00   ` Chris Engebretson
1998-05-20  4:00     ` Serguei Patchkovskii
1998-05-20  4:00       ` Larry Weiss
1998-05-20  4:00       ` Kaz Kylheku
1998-05-20  4:00         ` Larry Weiss
     [not found]         ` <125D9A1BA03D8776.FEF9821DB00860BE.0E4 <895712304snz@genesis.demon.co.uk>
1998-05-21  4:00           ` Chris Engebretson
1998-05-21  4:00           ` Kaz Kylheku
1998-05-21  4:00             ` Larry Weiss
     [not found]           ` <2DECFB7C2125FF12.8D639AF581546583.E29C243161345CFE@library-proxy.airnews.net>
1998-05-22  4:00             ` CoolDoug
1998-05-22  4:00               ` Kaz Kylheku
1998-05-22  4:00               ` Larry Weiss
1998-05-25  4:00             ` Rolf Magnus
1998-05-25  4:00               ` Larry Weiss
1998-05-29  4:00               ` Patrick M.
1998-05-24  4:00     ` Al Bowers
1998-05-20  4:00   ` Larry Weiss
1998-05-21  4:00   ` Asgar Ali
1998-05-21  4:00     ` Kaz Kylheku
1998-05-23  4:00     ` Gerald A. Feldman
1998-05-19  4:00 ` firewind
1998-05-19  4:00 ` Lawrence Kirby
1998-05-21  4:00   ` John Hascall [this message]
1998-05-22  4:00     ` Asgar Ali
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