home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / malloc-930716 / README < prev    next >
Encoding:
Text File  |  1993-12-20  |  2.0 KB  |  41 lines

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