Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!rutgers!cbmvax!daveb From: daveb@cbmvax.UUCP (Dave Berezowski) Newsgroups: comp.sys.amiga.tech Subject: Re: free memory defragmentation Message-ID: <5005@cbmvax.UUCP> Date: 17 Oct 88 02:36:53 GMT References: <9887@cup.portal.com> <3009@amiga.UUCP> <10003@cup.portal.com> Reply-To: daveb@cbmvax.UUCP (Dave Berezowski) Organization: Commodore Technology, West Chester, PA Lines: 35 In article <10003@cup.portal.com> dan-hankins@cup.portal.com writes: >In article <3009@amiga.UUCP> jimm@amiga.UUCP (Jim Mackraz) writes: > >>By the way: memory fragmentation on the Amiga occurs because there are >>actually allocated sections of memory between the freed chunks. There's >>been a lot of discussion on this already. >> >>Note that you can't concatenate two non-adjacent chunks. > >Ah. So what we need is an MMU (i.e. virtual memory). > >Hmmm. What would happen if the ALLOCATE and DEALLOCATE functions were >re-written in such a way that all memory would be allocated in 1k chunks? >Then successive calls to ALLOCATE would check to see if part of an >already-allocated chunk was available for allocation, and use that if it >could. > >That is, first call (100 bytes) results in a 1k chunk being allocated. >Second call results in a second pointer into the same 1k chunk. This might >reduce the problem you spoke of without as much need to resort to an MMU. > >If we could keep track of all pointers to a memory chunk, we could >rearrange them no problem. But then the Amiga OS isn't quite *that* >object-oriented. > Well you could keep ptrs to all your variables in one structure (sort of like a freelist) and periodically call a system routine like 'UnFragMemory' which would attempt to un-fragged memory by re-working all your variables (ie. all your memory use); copying the data as it needed to. Of course this scheme relies on the application writer; and we all know how dependable they are! :^) Regards, David Berezowski