home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15306 < prev    next >
Encoding:
Internet Message Format  |  1992-09-10  |  1.8 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!swrinde!news.dell.com!natinst.com!natinst.com!not-for-mail
  2. From: stepan@natinst.com (Stepan Riha)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: EditText items larger than 255 bytes?
  5. Message-ID: <18oe6rINN6sm@falcon.natinst.com>
  6. Date: 10 Sep 92 21:20:27 GMT
  7. References: <BuAyG1.8n7@iat.holonet.net> <2AAE73AE.49F@intercon.com> <1992Sep10.200136.18513@tamsun.tamu.edu>
  8. Organization: National Instruments, Austin, TX
  9. Lines: 29
  10. NNTP-Posting-Host: falcon.natinst.com
  11.  
  12. In article <1992Sep10.200136.18513@tamsun.tamu.edu> bpb9204@tamsun.tamu.edu (Brent) writes:
  13.  
  14.     [how to get more than 255 chars out of a dialog text item deleted]
  15.  
  16. >Now I have a question.  When you make a new TERecord, it is 32k in size,
  17. >right?
  18. >
  19. >If you have a modal dialog box with 4 text areas, that's automatically
  20. >128k of RAM sucked up for 4x255 = 1020 bytes for actualy data (retrieved or
  21. >set via the SetIText/GetIText calls.  If you used the MacOS calls to
  22. >the letter, that's a 1020/128k percent utilization... pretty awful.
  23. >
  24. >Hey, Apple!  How about creating a new TextEdit interface so that we can
  25. >specify the buffer size to use -- as large or small as we need?
  26. >
  27. >-Brent
  28.  
  29. When you make a new TERecord you only allocate memory for a TERec which is
  30. initially a little over 100 bytes large.  The actual text is stored in a handle
  31. that grows according to how much text you have.
  32. So if your (one-line) text contains 10 characters you'll use about 130 bytes
  33. which is less than a Str255.  If you actually have 255 characters in your
  34. item, you'll need about 43% more memory than if items used Str255; with 10
  35. characters you actually save about 50%.
  36.  
  37. Of course there is the overhead for two handles but that's quite negligible.
  38.  
  39. -- 
  40.    Stepan Riha -- stepan@natinst.com
  41.