🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #24730

Re: Philosophical programming question: handles

#24730
From: Richard Siegel
Date: Thu, 04 Feb 1988 20:20
28 lines
1830 bytes

"(A handle is a pointer to a pointer; it is
used for memory management purposes)"

It's more than just a pointer to a pointer. A handle's a pointer to a "master 
pointer", that points to a relocatable block in the Mac's heap. The memory 
manager can move this relocatable block at its leisure (unless the application 
explicitly requests that it stay in one place), and whenever it moves this 
relocatable block, it simply updates the master pointer. Since the pointer in 
your program always points to this master pointer, doing a double indirection 
will always get you to your data.

It's also worth noting that these master pointers aren't randomly scattered 
through memory, either; they're grouped into "master pointer blocks"; in the 
system heap, a master pointer block contains 32 master pointers; in the 
application heap, a master ptr block contains 64 master pointers.

In a Unix environment, I suspect, the memory management is not based on 
relocatable chunks of memory; rather, chunks are swapped in and out, and the 
memory manager keeps track of where they get swapped to and never moves them. 
(This is known as demand paging, I think.)

I don't know how small non-Unix 68000 systems behave. On the Intel machines 
such as the IBM PC, the memory is "segmented" into 64K pages. I'm not sure how 
dynamic memory management is handled, though...

		--Rich
Technical Details
Message-ID: <0W2BM7yQ2k-0kIo0Wi@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!uw-beaver!cornell!rochester!PT.CS.CMU.EDU!andrew.cmu.edu!rs4u+

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!uw-beaver!cornell!rochester!PT.CS.CMU.EDU!andrew.cmu.edu!rs4u+
From: rs4u+@andrew.cmu.edu (Richard Siegel)
Newsgroups: comp.sys.mac
Subject: Re: Philosophical programming question: handles
Message-ID: <0W2BM7yQ2k-0kIo0Wi@andrew.cmu.edu>
Date: 4 Feb 88 20:20:23 GMT
Organization: Carnegie Mellon University
Lines: 26
In-Reply-To: <870130@hpcilzb.HP.COM>