Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site cbdkc1.UUCP Path: utzoo!watmath!clyde!cbosgd!cbdkc1!gwe From: gwe@cbdkc1.UUCP ( George Erhart x4021 CB 3D288 RNB ) Newsgroups: net.micro.mac Subject: Re: Reviews wanted please Message-ID: <1305@cbdkc1.UUCP> Date: Thu, 13-Feb-86 07:54:11 EST Article-I.D.: cbdkc1.1305 Posted: Thu Feb 13 07:54:11 1986 Date-Received: Fri, 14-Feb-86 03:27:30 EST References: <396@3comvax.UUCP> <1430@wucs.UUCP> Reply-To: gwe@dkc1.UUCP ( George Erhart x4021 CB 3D288 RNB ) Distribution: net Organization: AT&T Bell Laboratories, Columbus Lines: 25 In article <1430@wucs.UUCP> jane@wucs.UUCP (Jane Mack) writes: >(1) The most troublesome problem is the code generated when you have a handle ^^^^^^ >to a record, and you assign the result of some function to one of the fields >in that record. The compiler caches the address of the record structure >in a register, calls the function, and then calculates the address of the >particluar field of the record that is to receive the result. It calculates >this result address using the address that it cached before the function call. >Well, as you can guess, if the function allocates a lot of memory, then >memory will be compacted to make room and the record structure will be >moved. Hence, the cached address is garbage. The keyword here is *handle*. Inside Mac makes a big deal about explaining the difference between handles and simple pointers. They state very clearly that if you are going to reference an item pointed to with handles, AND you are going to do anything that allocates memory ... lock the handle before using it or the memory manager may rearrange things on you. To be on the safe side ... lock all handles before using and unlock them when you are done. The purpose of having handles was to allow a form of garbage collection that is langauge independent. While it does mean that the programmer must aware of the process, it does provide for running larger programs and larger data structures. -- George Erhart at AT&T Bell Laboratories Columbus, Ohio 614-860-4021 {ihnp4,cbosgd}!cbdkc1!gwe