README 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. This is a fast malloc implementation that I wrote several years ago.
  2. I later used it as the basis of GNU malloc. My version differs from
  3. the GNU version in that it does not support debugging hooks, and does
  4. not record statistics. Therefore it is slightly faster.
  5. In order to safely link programs using this malloc with a C library
  6. that provides a different malloc, you need to make sure that
  7. malloc(), free(), and realloc() are defined in a single object file.
  8. Otherwise when linking you might get a combination of this malloc()
  9. with the library's free(). The Makefile builds such an object file,
  10. alloc.o.
  11. If you are using this malloc as the allocator for a C library of your
  12. own, and are not linking with another C library, then you don't need
  13. alloc.o. If you are building a C library, you should also write a
  14. replacement for the file "morecore.c" that doesn't pollute the name
  15. space.
  16. The header file "malloc.h" in this directory is NOT intended to be a
  17. public header file; it is for internal use by malloc and its
  18. friends. Don't install malloc.h in a public include directory!
  19. When porting this allocator to a new machine or operating system, you
  20. should inspect the definition of BLOCKSIZE in malloc.h to make sure
  21. it is greater than or equal to your target machine's virtual memory
  22. page size; otherwise valloc() won't work properly. (If you don't
  23. care about valloc() then BLOCKSIZE doesn't matter.)
  24. You will also need to provide a machine-dependent _default_morecore()
  25. function; see morecore.c for a sample version that works on Unix.
  26. Your morecore function should return a pointer to a newly allocated
  27. region of the given size, aligned on the most pessimistic alignment
  28. boundary for the machine. Subsequent calls to morecore should return
  29. contiguous memory, and calls to morecore with a negative argument
  30. should return memory to the system. If no memory is available
  31. morecore should return NULL.
  32. Bug reports to Mike Haertel, mike@cs.uoregon.edu.
  33. This version is dated March 26, 1993; include this
  34. date with your bug report.