Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!olivea!uunet!zephyr.ens.tek.com!uw-beaver!rice!hsdndev!dartvax!eleazar.dartmouth.edu!ari From: ari@eleazar.dartmouth.edu (Ari Halberstadt) Newsgroups: comp.sys.mac.programmer Subject: Re: CompactMem with MultiFinder partitions Keywords: Multifinder, Partitions, fragmented memory Message-ID: <1991Jun21.202440.12139@dartvax.dartmouth.edu> Date: 21 Jun 91 20:24:40 GMT References: <1991Jun20.041856.5918@cec1.wustl.edu> Sender: news@dartvax.dartmouth.edu (The News Manager) Organization: Dartmouth College, Hanover, NH Lines: 21 In article <1991Jun20.041856.5918@cec1.wustl.edu> jyp@wucs1.wustl.edu (Jerome Yvon Plun) writes: >If you have multiple applications being launched and terminating in random >order, you are bound to fragment your memory and not be able to obtain a >application partition as big as the free memory. >If we were dealing with handle, a call to CompactMem would do the trick >(as in NewHandle or NewPtr). Can a similar approach be undertaken by a >little program that would move an entire partition in memory and update >the value of A5 for that partition? It isn't sufficient to change A5, since it is likely that the application has stored many addresses directly. For instance, taking the address of a function doesn't return a reference off of A5, it returns a reference directly into the jump table. And, of course, you'd have to change all the handles and pointers, not to mention copies of the handles and pointers. No, it's not feasible to actually move the application. But with virtual memory you could remap the partition to somewhere else in physical memory. So you could move the application, then use VM to make it think it was still in its old location, simply by adding an offset to every address. I don't know if VM can be controled to this extent by system 7.0 programmers. You might still have to update operating system data structures (like the process manager), and this is certainly very difficult without access to the source code.