Re: The joy of garbage collection



As Alan wrote, it's easiest to just write your Lisp inside Lisp, so you get all the benefits from a good compiler and a performant garbage collector for your language (and for free!).

If you want to experiment with garbage collection, however, I suggest you read some nice papers on memory management from this page:
http://www.cs.utexas.edu/users/oops/papers.html
especially "Uniprocessor Garbage Collection Techniques" and "Dynamic Storage Allocation: A Survey and Critical Review", maybe the second one before the first if you want to know how other memory managers (malloc) are implemented.


To answer your free-list question: it depends how you manage memory. If you get your memory blocks from malloc(), then the GC's sweep-phase should free() the blocks. If you roll your own memory manager on large blocks (that malloc() or some other means provides), then of course you need your own mechanism (such as free-lists) to make sure that that memory is available for future allocation requests.

--
Do or do not.  There is no try.
  Yoda
.



Relevant Pages

  • Re: ANN: Q language website (new)
    ... "Garbage Collection Can Be Faster Than Stack Allocation" ... > the necessary skills to optimize their use of malloc and free and know ... Same with C++ developers in their ... > mixing different methods of memory management is not a good idea (a la ...
    (comp.lang.misc)
  • Re: C++ sucks for games
    ... >level language as an example (I don't know for sure that it doesn't because ... >(e.g. you get nontrivial memory management issues if ever you want to have ... Most complicated Lisp programs eventually end up in the FFI ... people who learned lower level languages ...
    (comp.lang.lisp)
  • garbage collection and memory management
    ... For a lot of software naive consing and using naive Garbage Collection ... is not THE single method of memory management. ... GCs during disk read and write? ... Cost of varying access times? ...
    (comp.lang.lisp)
  • Re: Ada memory management seems slow
    ... >> GNAT uses malloc and free from the C library for memory management - so ... >> performace is the same as with C. ... Where you find almost the full sources for all gnat library functions. ...
    (comp.lang.ada)
  • Re: segmentation fault on calloc
    ... >> documentation, that's equally important to code quality when dealing ... seen lots of crashes in malloc, calloc and free, and all of them were ... the end of an allocated block, it is almost certain to overwrite some ... to a memory management function (no other code is allowed to touch ...
    (comp.unix.programmer)