home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22146 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.6 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!ucdavis!flauta.engr.ucdavis.edu!cklarson
  2. From: cklarson@flauta.engr.ucdavis.edu (Christopher Klaus Larson)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Recommended way to deal with large memory buffers?
  5. Message-ID: <21770@ucdavis.ucdavis.edu>
  6. Date: 25 Jan 93 18:56:21 GMT
  7. References: <9301221923.aa23160@Paris.ics.uci.edu> <1jqeefINNcio@darkstar.UCSC.EDU>
  8. Sender: usenet@ucdavis.ucdavis.edu
  9. Organization: College of Engineering - University of California - Davis
  10. Lines: 20
  11.  
  12. In article <1jqeefINNcio@darkstar.UCSC.EDU> speth@cats.ucsc.edu (James Gustave) writes:
  13. >
  14. >  I'm working on an encryption application, and I need to go through a file,
  15. >encrypt it, and write it to a new file.  The encryption routine takes a Ptr
  16. >to a buffer, and a count of the number of bytes to process.  For small files,
  17. >it makes sense to read the whole file into the buffer and do the encryption.
  18. >However, this means that the maximum size of the file to be encrypted is
  19. >determined by the amount of memory the program can allocate.  On the other
  20. >hand, if I did the encryption incrementally, writing the parts to a temp file,
  21. >then there might be a lot of unnecessary disk access which would slow down
  22. >the process.
  23.  
  24. You should figure out how much memory would be required to process the entire
  25. file at once and see if there is a block of temporary memory of this size
  26. available. If so, go ahead and use it. If not, you will have to process the
  27. file in pieces by using the buffer allocated within your application heap.
  28. See Inside Macintosh: Memory for details.
  29.  
  30. --Chris
  31. cklarson@engr.ucdavis.edu
  32.