Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!bionet!agate!shelby!neon!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Newsgroups: comp.sys.mac.misc Subject: Re: Mac & Win: Questions about memory management Keywords: Mac, Win, MS Windows, memory management Message-ID: <1990Jul15.003910.15391@Neon.Stanford.EDU> Date: 15 Jul 90 00:39:10 GMT References: <3102@gmdzi.UUCP> Sender: news@Neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Computer Science Department, Stanford University Lines: 55 In article <3102@gmdzi.UUCP>, strobl@gmdzi.UUCP (Wolfgang Strobl) writes: > [I am posting this on behalf of Ken, so please reply to him, not me!] [request for Windows/Mac discussion] > To get the ball rolling, I have some questions about Mac memory management > at System 6 and 7. > > In Windows, applications do not (should not) hold pointers to data in the > global heap. They instead hold handles which can be dereferenced to find > the pointer. This allows the OS to move blocks to produce a larger contig- > uous space when it needs one. > > If I understand the Mac model (sys 6 w/MultiFinder), the applications are > given a workspace or contiguous memory and that workspace does not move at > all during the life of the invocation. > > Is my understanding of the Mac way correct? What if an app needs more > memory, can it request that its partition be increased in size? Is there > any way to unfragment memory? Does system 7 change this? Would a PMMU > help? I don't know about System 7 (but have a strong feeling there's no radical change). Because of its origin as a single application at a time system, the Mac allocates a fixed partition for each application. This partition contains the application's heap (called a "zone"). It's possible to create a additional zones, if you have complex memory mangement requirements. In addition, there is a system heap, and free space not yet allocated. It's possible for a program to ask for a chunk out of this free space (e.g., as temporary space for a buffer). The heap contains two kinds of data objects: pointer-referenced and handle-referenced. Handles - as in Windows - allow defragmentation. However, this is _within_ a specific heap. Global memory can be fragmented; however this is only a problem if you frequently launch/quit applications. The only solution if you run out of space to launch a new application (if there's enough free space total, but not in biggest free block) is to kill (and maybe relaunch) applications. In practice, this works reasonably well for users; memory management is a big headache for programmers, especially beginners who are used to more forgiving systems. Adding a PMMU does not radically change the picture, because all programs are still running in the same (potentially fragmentable) address space. > Kenneth S. Blackney > Phone: (215) 895-1505 Drexel University > Internet: Ken_Blackney@DUPR.OCS.Drexel.EDU Computing Services > Bitnet: BLACKNEY@DUPR.BITNET Philadelphia, PA 19104 Philip Machanick philip@pescadero.stanford.edu