home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15421 < prev    next >
Encoding:
Text File  |  1992-09-13  |  2.1 KB  |  49 lines

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