Article View: comp.sys.amiga.tech
Article #8479Re: Alloc Remember sytems.
From: Chuck McManis
Date: Wed, 13 Apr 1988 17:26
Date: Wed, 13 Apr 1988 17:26
34 lines
1839 bytes
1839 bytes
In article <2804@crash.cts.com> haitex@pnet01.cts.com (Wade Bickel) writes:
> The puzzle is how to handle the case where CHIP memory is allocated in
>place of FAST memory (ie: No FAST mem. was avail). This must be fast!
Well my allocator uses Exec nodes linked together to create 'remember'
list. The following routines are implemented :
(char *)mmalloc(mptr,size,attributes);
/* just like alloc remember :-) */
SHORT mmark(mptr);
/* Returns a memory "marker" */
BOOL mfreemark(mptr,int);
/* Free's everything past the mark */
BOOL mfree(mptr,ptr);
/* Free memory associated with this pointer */
BOOL mfreeall(mptr);
/* Free all memory associated with this pointer */
The structure that this maintains looks something like this :
struct mmallocstruct {
struct Node mm_Node; /* Node list (14 bytes) */
int mm_Mark; /* Memory "marker" */
int mm_Size; /* Memory chunk size */
int mm_Pad; /* force longword alignment */
long mm_Data; /* First longword of data */
}
The allocations actually allocate enough memory to store both the memory
node and the data and return a pointer to the data. &(mm.mm_Data)
Now it does "waste" 20 bytes each time you allocate something but it
is useful.
--Chuck McManis
uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.
Technical Details
Message-ID:
<49383@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!oliveb!sun!pepper!cmcmanisReferences:
<2804@crash.cts.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!oliveb!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Alloc Remember sytems. Message-ID: <49383@sun.uucp> Date: 13 Apr 88 17:26:12 GMT References: <2804@crash.cts.com> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 34