home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / 19190 < prev    next >
Encoding:
Text File  |  1992-11-16  |  2.3 KB  |  51 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!think.com!paperboy.osf.org!spinner.osf.org!drand
  3. From: drand@spinner.osf.org (Douglas S. Rand)
  4. Subject: Re: FLAME, FLAME ON X!!!
  5. Message-ID: <1992Nov16.162457.2923@osf.org>
  6. Sender: news@osf.org (USENET News System)
  7. Organization: Open Software Foundation
  8. References: <1683@igd.fhg.de> <1992Nov9.235741.25166@dsd.es.com> <RJC.92Nov13144522@daiches.cogsci.ed.ac.uk>
  9. Date: Mon, 16 Nov 1992 16:24:57 GMT
  10. Lines: 39
  11.  
  12. In article <RJC.92Nov13144522@daiches.cogsci.ed.ac.uk>, rjc@cogsci.ed.ac.uk (Richard Caley) writes:
  13. |> In article <1992Nov10.173203.10719@dsd.es.com>, Paul Martz (pm) writes:
  14. |> 
  15. |> pm> Yes but this doesn't sound like what the guy's describing. If this is
  16. |> pm> just free() only freeing memory back to the process, then starting the
  17. |> pm> same X client over again and walking it through the same sequence of
  18. |> pm> tasks should not cause the server process size to grow, because the
  19. |> pm> memory it freed before is still available to it.
  20. |> 
  21. |> The word is `Fragmentation'. 
  22. |> 
  23.  
  24. There are a number of reasonable solutions to memory fragmentation.  It really
  25. is up to a decent malloc implementation to attempt to avoid fragmentation.
  26. I'll illustrate with a well known method which we used on Prime's EMACS and
  27. which I believe libg++ uses.  
  28.  
  29. Allocate all memory in set size chunks.  Sizes can be on powers of two, for
  30. example.  Freeing a block places it on a free list for that size.  Allocation
  31. requests first go to the most natural next size block and progress upward in
  32. size.  Optionally break larger blocks if no smaller blocks are available.
  33. Optionally run the block lists on occation and join smaller contiguous
  34. blocks into larger blocks.  
  35.  
  36. This is not the only means available.  It works very well for things like
  37. EMACS or the X server which allocate and free the same objects all the
  38. time.  It adds minimal overhead to memory allocation (about 2 or 3 times
  39. the stupid method).  
  40.  
  41. Remember that the sample server is a "sample" implementation and is not
  42. presented as the final word in efficiency,  device driving or whatever.
  43. It is considered to be correct.  Of course,  many people use it as
  44. if it were commercial software.
  45.  
  46. -- 
  47. Douglas S. Rand <drand@osf.org>        OSF/Motif Dev.
  48. Snail:         11 Cambridge Center,  Cambridge,  MA  02142
  49. Disclaimer:    I don't know if OSF agrees with me... let's vote on it.
  50. Amateur Radio: KC1KJ
  51.