🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How serious is memory fragmentation?

#12516
From: Chuck McManis
Date: Thu, 04 May 1989 18:05
45 lines
2429 bytes
In article <9504@watcgl.waterloo.edu> (Blair MacIntyre) writes:
>	Because the Amiga has no MMU, etc., we get memory fragmentation
>as we allocate/deallocate, right?  So, what I'm wondering is this:

Not exactly. 

>If I want to do alot of small allocs/frees, am I going to fragment
>memory beyond belief?  I'm thinking of something on the order of 
>alocating a new line buffer every time a line is changed ( including
>freeing the old one ).  That isn't exactly the use, but it is about
>the frequency.  

This won't necessarily affect fragmentation, if there isn't much other
activity going on then you will be fine. However if another task allocates
a 32K chunk, then you allocate a line buffer, and then that task frees
it's 32K chunk it will sit there as a fragment until you free your line 
buffer.

>Would it be better to manage my own free pool?  I don't like the
>concept of pre-allocating large chunks, however.

Depends on the application, in the case of line buffers it makes more
sense for you to do so since your internal allocator will probably be
faster than AllocMem.

>Does the system unify adjoining blocks of free memory into bigger
>blocks?

Yes.

>It seems to me that I _shouldn't_ have to worry about this stuff,
>but for some reason I am ...

Two biggest problems with memory allocation on the Amiga are, first
if you stomp the memory list (write at a negative offset from the 
memory chunk you got) you can confuse the allocater into thinking 
memory is hosed. Second, if you use AllocRemember() and call FreeRemember(,0)
then it doesn't free the little 8byte chunks that have the list headers 
associated with them and that will fragment memory.


--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.
"A most excellent barbarian ... Genghis Kahn!"
Technical Details
Message-ID: <103009@sun.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!sun-barr!texsun!pitstop!sun!pepper!cmcmanis
References: <9504@watcgl.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!sun-barr!texsun!pitstop!sun!pepper!cmcmanis
From: cmcmanis%pepper@Sun.COM (Chuck McManis)
Newsgroups: comp.sys.amiga.tech
Subject: Re: How serious is memory fragmentation?
Message-ID: <103009@sun.Eng.Sun.COM>
Date: 4 May 89 18:05:32 GMT
References: <9504@watcgl.waterloo.edu>
Sender: news@sun.Eng.Sun.COM
Reply-To: cmcmanis@sun.UUCP (Chuck McManis)
Distribution: na
Organization: Sun Microsystems, Mountain View
Lines: 45