home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18152 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.6 KB  |  41 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!gatech!concert!sas!mozart.unx.sas.com!walker
  3. From: walker@twix.unx.sas.com (Doug Walker)
  4. Subject: Re: How to allocate memory nicely?
  5. Originator: walker@twix.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <C0DwAL.2L5@unx.sas.com>
  8. Date: Tue, 5 Jan 1993 14:01:33 GMT
  9. References:  <1iasdiINN754@uniwa.uwa.edu.au>
  10. Nntp-Posting-Host: twix.unx.sas.com
  11. Organization: SAS Institute Inc.
  12. Lines: 27
  13.  
  14.  
  15. In article <1iasdiINN754@uniwa.uwa.edu.au>, gujn@uniwa.uwa.edu.au (Jeremy Nelson) writes:
  16. |> This is probably a simple question for the programmers, so reply by news
  17. |> or mail as you see fit...
  18. |> 
  19. |> How should I allocate memory for short strings of, say, 15 characters or
  20. |> so without unnecessarily fragmenting the memory?   Should I request 1k
  21. |> chunks and doll it out as necessary?  And how small is too small?
  22. |> 
  23. |> Help from the experienced would be appreciated.  Thanks. (I'm talking 
  24. |> C of course. :)
  25.  
  26. I suggest using malloc().  malloc() should allocate fairly large chunks
  27. and dole them out for you (depending, of course, on whose implementation
  28. of malloc() you are using.)
  29.  
  30. |> Jem.  Jeremy Nelson.  gujn@uniwa.uwa.edu.au       :\  =>  :) 
  31.  
  32. -- 
  33.   *****
  34. =*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
  35.  *|. o.| ||                                          1200/2400/9600 Dual
  36.   | o  |//     For all you do, this bug's for you!
  37.   ====== 
  38. usenet: walker@unx.sas.com                            bix: djwalker 
  39. Any opinions expressed are mine, not those of SAS Institute, Inc.
  40.  
  41.