🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #3523

Re: De-Allocating Memory?

#3523
From: John Meissen
Date: Tue, 08 May 1990 17:49
31 lines
1959 bytes
In article <12750@wpi.wpi.edu> pawn@wpi.wpi.edu (Kevin Goroway) writes:
>I think I need some quick tutoring as to how one deallocates memory:
>
>I'm doing an awful lot of mallocs to create a lot of linked lists...

If you are going to be allocating memory that you will need to give back
to the system (the friendliest way, really), use AllocMem and FreeMem
instead of malloc and free. Just be sure you give it all back explicitly
before exiting.
>
>I don't get any memory back...
>I tried using lattices rbrk() with no luck...

I don't remember the rbrk() code, but in general the Lattice routines
manage a local memory pool under the general assumption that it is
usually more expensive to go to the operating system to get memory. This
may not be true for the Amiga, but the Lattice code is used on a lot of
machines. When you free memory, it goes back into the pool, not to the
system.

>Also, I'd love to use AllocRemember, but the code in the Intuition Manual
>and Rom Kernal just don't work. (crash...)

They work fine, I use them a lot. The thing you need to remember is that
you must pass them the ADDRESS of the POINTER to the Remember structure,
not the address of the structure.
-- 
 John Meissen ............................... Oregon Advanced Computing Institute
 jmeissen@oacis.org        (Internet) | "That's the remarkable thing about life;
 ..!sequent!oacis!jmeissen (UUCP)     |  things are never so bad that they can't
 jmeissen                  (BIX)      |  get worse." - Calvin & Hobbes
Technical Details
Message-ID: <487@oregon.oacis.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!oregon!jmeissen
References: <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!uunet!ogicse!oregon!jmeissen
From: jmeissen@oregon.oacis.org (John Meissen)
Newsgroups: comp.sys.amiga.tech
Subject: Re: De-Allocating Memory?
Keywords: Lattice 5.04?
Message-ID: <487@oregon.oacis.org>
Date: 8 May 90 17:49:59 GMT
References: <12750@wpi.wpi.edu>
Organization: Oregon Advanced Computing Institute (OACIS), Beaverton, OR
Lines: 31