Article View: comp.sys.amiga.tech
Article #3530Re: De-Allocating Memory?
From: Chuck McManis
Date: Tue, 08 May 1990 18:32
Date: Tue, 08 May 1990 18:32
27 lines
1663 bytes
1663 bytes
In article <12750@wpi.wpi.edu> pawn@wpi.wpi.edu (Kevin Goroway) writes:
>I don't get any memory back...
The "free()" function doesn't free memory in the AllocMem sense, it
returns it to the pool that malloc() will look in. This is to support
the UNIX semantic of reallocating memory you just freed having the
same contents. [It is documented in the Lattice manual btw]
>Also, I'd love to use AllocRemember, but the code in the Intuition Manual
>and Rom Kernal just don't work. (crash...)
Did you note that these routines take a pointer to a pointer? That is
to say that AllocRemember() is prototyped as :
void *AllocRemember(struct Remember **, long, long);
These routines work fine when used properly. In your case you could
actually use just AllocMem/FreeMem because you know the sizes of the
objects you are freeing. AllocRemember has the advantage that you can
free a whole bunch of memory without having to free each chunk.
--
--Chuck McManis Sun Microsystems
uucp: {anywhere}!sun!cmcmanis BIX: <none> Internet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"I tell you this parrot is bleeding deceased!"
Technical Details
Message-ID:
<135370@sun.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!texbell!texsun!newstop!sun!stpeter.Eng.Sun.COM!cmcmanisReferences:
<12750@wpi.wpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!texbell!texsun!newstop!sun!stpeter.Eng.Sun.COM!cmcmanis From: cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: De-Allocating Memory? Keywords: Lattice 5.04? Message-ID: <135370@sun.Eng.Sun.COM> Date: 8 May 90 18:32:05 GMT References: <12750@wpi.wpi.edu> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 27