home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!sunic!kth.se!cyklop.nada.kth.se!d88-jwa
- From: d88-jwa@cyklop.nada.kth.se (Jon W{tte)
- Subject: Re: handles and MoveHHi
- In-Reply-To: francois@welchgate.welch.jhu.edu's message of Sun, 13 Sep 1992 16:12:38 GMT
- Message-ID: <D88-JWA.92Sep13193711@cyklop.nada.kth.se>
- Originator: d88-jwa@cyklop.nada.kth.se
- Sender: usenet@kth.se (Usenet)
- Nntp-Posting-Host: cyklop.nada.kth.se
- Organization: Royal Institute of Technology, Stockholm, Sweden
- References: <1992Sep13.161238.28426@welchgate.welch.jhu.edu>
- Date: Sun, 13 Sep 1992 18:37:11 GMT
- Lines: 34
-
- > francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
-
- Hi, sorry if these questions are a FAQ but here goes:
-
- - is there a real advantage to using MoveHHi before locking your
- handles, I have not really seen much on that except that Think Reference
- suggests that is *may* help in reducing heap fragmentation. Are there
- any definite rules for using MoveHHi and caveat.
-
- MoveHHi is, uh, somewhat expensive since the toolbox
- goes to a fair amount of trouble to move stuff out of
- the way and move the handle HIGH up in the heap.
-
- If you're going to keep the handle locked for a long
- time (i.e. a minute or more...) it's a very good idea,
- but if you only lock the handle to pass it to a toolbox
- routine, it's no idea. (Or rather, a bad idea)
-
- - Also when passing parameters in C is it better to use pointers or
- handles. I guess the answer is really along the lines of it depends
- on what you do with them afterwards, ie do you lock them, do you need to
- allocate new memory, etc. Does anyone have any guidelines for this.
-
- Well, if it's a handle from the start, pass it as a handle
- as far as possible, because you get more constrained when
- you can't "do" anything with a handle. Also, if your function
- takes a pointer, never assume that's a dereferenced handle.
- RecoverHandle is EXPENSIVE! The reverse is also true; don't
- pass the address of a pointer to something that wants a handle.
-
- --
- Jon W{tte, h+@nada.kth.se, Sweden, Phone +46-8-107069
-
- Help eradicate FIDO-Net <-> Usenet gateways in our time!
-