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