From: fred@genesis.demon.co.uk (Lawrence Kirby)
Subject: Re: How do you release memory back to the kernel in C
Date: 1998/05/19 [thread overview]
Message-ID: <895607898snz@genesis.demon.co.uk> (raw)
In-Reply-To: 35616C36.9167165F@citicorp.com
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.
On a VM system unused memory teds to get moves to swap space. As long as you
don't run out of swap space it may not be a big problem.
>I have a simple program below which illustrates the problem.
>The program allocates 10Mb, then another 10Mb, then frees the second,
>then frees the first. Both frees do not release the memory back to
>kernel, though the same process could reuse its free memory.
That is typical. The C language doesn't require that freed memory be released
in this way, indeed it provides no answer to your question. You could try
finding a replacement malloc() library that does what you want or try to
find some platfor-specific alternative. For example many Unix platforms
these days support a mmap() system function which may well provide a solution.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
next prev parent reply other threads:[~1998-05-19 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 ` 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 ` Larry Weiss
1998-05-22 4:00 ` Kaz Kylheku
1998-05-25 4:00 ` Rolf Magnus
1998-05-25 4:00 ` Larry Weiss
1998-05-29 4:00 ` Patrick M.
1998-05-20 4:00 ` Larry Weiss
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 ` Lawrence Kirby [this message]
1998-05-21 4:00 ` John Hascall
1998-05-22 4:00 ` Asgar Ali
1998-05-19 4:00 ` firewind
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