[comp.sys.amiga] gladiator from hell

wdao@castor.usc.edu (Walter Dao) (09/24/88)

let's say I want to alloc several blocks of mem. Is it better to do an 
allocmem for each of them ? (so for 2 bitplanes and 1 copper list I would call
alloc mem 3 times and fremem 3 times at the end )
or just use 1 huge alloc mem (then I would use an alloc mem 17k. long ,
bitplane 1 would be at the address returned by the alloc mem func, bp_2 would
be at that address + 8k and the copper list at the original adress + 16 )
and only 1 freemem would be needed.
In the first case , a fragmemted memory (utilites floating around the memory)
would cause less failure to occur in the alloc mem process. But it takes time
(relatively) to free all the blocks. 
In the second time, time is saved (1 alloc mem insstead of 3) but if there are
no free contiguous memory of the required size, it would fail . 


So what is better ? 


                                     asdfasdfasdf the merciless .

dillon@CORY.BERKELEY.EDU (Matt Dillon) (09/25/88)

>let's say I want to alloc several blocks of mem. Is it better to do an 
>allocmem for each of them ? (so for 2 bitplanes and 1 copper list I would call
>alloc mem 3 times and fremem 3 times at the end )
>or just use 1 huge alloc mem (then I would use an alloc mem 17k. long ,
>bitplane 1 would be at the address returned by the alloc mem func, bp_2 would
>be at that address + 8k and the copper list at the original adress + 16 )
>and only 1 freemem would be needed.
>In the first case , a fragmemted memory (utilites floating around the memory)
>would cause less failure to occur in the alloc mem process. But it takes time
>(relatively) to free all the blocks. 
>In the second time, time is saved (1 alloc mem insstead of 3) but if there are
>no free contiguous memory of the required size, it would fail . 
>
>So what is better ? 

	For blocks of the size you want, allocate them separately.  It takes
the same amount of memory to allocate a reasonably sized blocks all at once vs
each separately, and as you said, larger allocate's might fail due to
memory fragmentation.

	FreeMem() is not slow.  Freeing 10000 small memory blocks may take
a while, but you would not notice the difference between 1 and 3 ... or 1 and
50 for that matter.  The block size does NOT effect how fast FreeMem()
runs.

					-Matt

dale@boing.UUCP (Dale Luck) (10/01/88)

In article <1455@nunki.usc.edu> wdao@castor.usc.edu (Walter Dao) writes:
>
>allocmem for each of them ? (so for 2 bitplanes and 1 copper list I would call
>alloc mem 3 times and fremem 3 times at the end )
>or just use 1 huge alloc mem (then I would use an alloc mem 17k. long ,

In general you should allocate seperate pieces. Use the call for
AllocRaster. Future machines may have to obey some alignment
restrictions, or maybe if certain alignment restrictions are
followed then greater speed could be realized, maybe for a
32bit blitter, ya, that's the ticket.
-- 
Dale Luck     Boing, Inc. {cbmvax|oliveb|pyramid}|!amiga!boing!dale
Although I do contract work for Amiga-LosGatos, my opinions probably
don't represent those of Commodore or its management or its engineers,
but I think the world would be a better place if they did.

dale%boing.uucp@UDEL.EDU (10/04/88)

Received: from CUNYVM by CUNYVM.BITNET (Mailer X2.00) with BSMTP id 4889; Sun,
 02 Oct 88 00:32:04 EDT
Received: from UDEL.EDU by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with TCP; Sun, 02
 Oct 88 00:32:01 EDT
Received: from Louie.UDEL.EDU by Louie.UDEL.EDU id aa24914; 1 Oct 88 5:25 EDT
Received: from USENET by Louie.UDEL.EDU id aa24782; 1 Oct 88 5:21 EDT
From: Dale Luck <dale@boing.uucp>
Subject: Re: gladiator from hell
Keywords: sexual tyranosaures .
Message-ID: <412@boing.UUCP>
Date: 1 Oct 88 05:36:27 GMT
Organization: Boing, Milpitas, Ca.
To:       amiga-relay@UDEL.EDU
Sender:   amiga-relay-request@UDEL.EDU

In article <1455@nunki.usc.edu> wdao@castor.usc.edu (Walter Dao) writes:
>
>allocmem for each of them ? (so for 2 bitplanes and 1 copper list I would call
>alloc mem 3 times and fremem 3 times at the end )
>or just use 1 huge alloc mem (then I would use an alloc mem 17k. long ,

In general you should allocate seperate pieces. Use the call for
AllocRaster. Future machines may have to obey some alignment
restrictions, or maybe if certain alignment restrictions are
followed then greater speed could be realized, maybe for a
32bit blitter, ya, that's the ticket.
--
Dale Luck     Boing, Inc. {cbmvax|oliveb|pyramid}|!amiga!boing!dale
Although I do contract work for Amiga-LosGatos, my opinions probably
don't represent those of Commodore or its management or its engineers,
but I think the world would be a better place if they did.