Path: utzoo!attcan!uunet!cbmvax!bpa!rutgers!mailrus!ulowell!m2c!applix!scott From: scott@applix.UUCP (Scott Evernden) Newsgroups: comp.sys.amiga Subject: Re: Memory Fragmentation, looking for compaction Message-ID: <928@applix.UUCP> Date: 20 Mar 89 02:47:40 GMT References: <598@jc3b21.UUCP> Reply-To: scott@applix.UUCP (Scott Evernden) Distribution: comp Organization: APPLiX Inc., Westboro MA Lines: 28 In article <598@jc3b21.UUCP> fgd3@jc3b21.UUCP (Fabbian G. Dufoe) writes: > I've spent quite a bit of time recently looking at the Amiga's memory >management. I don't believe there is any way to write a utility to compact >memory. >... > If you were to write a program to compact free memory you would need >to know, for each allocated block you moved, every place in the system that >had a pointer to that block so you could revise the pointer. A memory subsystem which relies on doubly indirect pointers (called "handles") will allow for memory compaction. The Mac OS provides a facility which does this. An application must "lock" a handle to a data structure before accessing it; it "unlock"s the handle when it is not being used. The memory system is therefore free to move unlocked data/memory in order to coalesce holes. You simply need to make sure that you store any references to data via handles and not pointers. The handle is nothing more than an index into a table which provides the true current location of the information. This idea can be extended to provide a form of virtual memory. Data chunks, being freely mobile, can be swapped to secondary storage if the main memory pool becomes congested. As long as the total locked memory is smaller than the memory pool, total virtual storage requirements are limited only by disk size. Is anyone working on this? I think this might make a neat project. -scott