Mail Archives: djgpp/1998/11/29/14:39:20
From: | sparhawk AT eunet DOT at (Gerhard Gruber)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Djgpp doesn't free the memory? What am I doing wrong?
|
Date: | Sat, 28 Nov 1998 23:07:58 GMT
|
Organization: | Customer of EUnet Austria
|
Lines: | 43
|
Message-ID: | <366e011c.12704288@news.Austria.EU.net>
|
References: | <36594f0d DOT 209084 AT news DOT jet DOT es>
|
NNTP-Posting-Host: | e236.dynamic.vienna.at.eu.net
|
Mime-Version: | 1.0
|
X-Trace: | fleetstreet.Austria.EU.net 912290970 11717 193.154.184.236 (28 Nov 1998 22:09:30 GMT)
|
X-Complaints-To: | abuse AT Austria DOT EU DOT net
|
NNTP-Posting-Date: | 28 Nov 1998 22:09:30 GMT
|
X-Newsreader: | Forte Agent 1.5/32.451
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id JAB07796
|
Reply-To: | djgpp AT delorie DOT com
|
Destination: gradha AT iname DOT com (Grzegorz Adam Hankiewicz)
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Mon, 23 Nov 1998 12:14:07 GMT:
>
>But, the example ends and it cannot allocate the 5 meg chunk, because
>the pointers are not freed. Tracing the loops within Rhide, on the top
>right corner there's the free mem, and it decreases to <1 meg, but
>then it doesn't go up again when freeing. I have also tried allocating
>first twenty 1 meg chunks, then 1 25 meg, and rest with 1 meg chunks,
>but still cannot free the memory.
>
>I am obviously doing something wrong, but I don't know what. Could
>somebody please help me?
As far as I remeber implementations of malloc/free don't neccessarily free the
allocated memory to the system. Instead they keep the take chunks from the
systemmemory and keep them chached once it is taken from the OS. I think this
is because it costs less overhead to the OS instead of constantly allocating
and deallocating systemmemory and also avoids splitting up memory in many very
small blocks.
Why do you need to allocate memory if you free it again anyway? Usually one
should allocate as much as one need and use this up.
--
Bye,
Gerhard
email: sparhawk AT eunet DOT at
g DOT gruber AT sis DOT co DOT at
Spelling corrections are appreciated.
ICQ#: 18578771
Torture your data until they confess. (Einstein)
- Raw text -