@end format
This file documents the GNU mmalloc (mapped-malloc) package, written by
-fnf@@cygnus.com.
+fnf@@cygnus.com, based on GNU malloc written by mike@@ai.mit.edu.
Copyright (C) 1992 Free Software Foundation, Inc.
@subtitle The GNU memory-mapped malloc package
@author Fred Fish
@author Cygnus Support
+@author Mike Haertel
+@author Free Software Foundation
@page
@tex
@chapter Overall Description
This is a heavily modified version of GNU @code{malloc}. It uses
-@code{mmap} as the basic mechanism for for obtaining memory from the
+@code{mmap} as the basic mechanism for obtaining memory from the
system, rather than @code{sbrk}. This gives it several advantages over the
more traditional malloc:
@itemize @bullet
@item
-Providing suitable precautions are taken to avoid memory region
-collisions, @code{sbrk} is now available for use by applications that
-use this package and still need to use some memory management
-package that includes functions like @code{malloc}, @code{realloc}, and
-@code{free}.
-
-@item
-Several different memory pools can be used, each of them growing
+Several different heaps can be used, each of them growing
or shinking under control of @code{mmap}, with the @code{mmalloc} functions
-using a specific pool on a call by call basis.
+using a specific heap on a call by call basis.
@item
-By using @code{mmap}, it is easy to create data pools which are intended to
+By using @code{mmap}, it is easy to create heaps which are intended to
be persistent and exist as a filesystem object after the creating
process has gone away.
@item
-Because multiple memory pools can be managed, data used for a
-specific purpose can be allocated into its own memory pool, making
+Because multiple heaps can be managed, data used for a
+specific purpose can be allocated into its own heap, making
it easier to allow applications to ``dump'' and ``restore'' initialized
malloc-managed memory regions. For example, the ``unexec'' hack popularized
by GNU Emacs could potentially go away.
with (along with other information). This parameter is called the
@dfn{malloc descriptor}.
-For ease of initial implementation, and to avoid exporting or importing
-any more global variables or routines than necessary, this package is
-implemented with all functions contained within a single source file.
-At some future point, once everything has stabilized, it may be desirable
-to split it up into separate files.
-
The functions initially provided by @code{mmalloc} are:
@example
@code{free} functions to be implemented as special cases of the
@code{mmalloc} functions. In particular, if any of the functions that
expect malloc descriptors are called with a @code{NULL} pointer rather than a
-valid malloc descriptor, then they default to using a memory-mapped region
-starting at the current @code{sbrk} value and mapped to @file{/dev/zero}.
-Applications can simply include the following defines to use the
-@code{mmalloc} versions:
+valid malloc descriptor, then they default to using an @code{sbrk} managed
+region.
+The @code{mmalloc} package provides compatible @code{malloc}, @code{realloc},
+and @code{free} functions using this mechanism internally.
+Applications can avoid this extra interface layer by simply including the
+following defines:
@example
#define malloc(size) mmalloc ((void *)0, (size))
or replace the existing @code{malloc}, @code{realloc}, and @code{free}
calls with the above patterns if using @code{#define} causes problems.
-Note that this does not prevent calls to @code{malloc}, @code{realloc},
-or @code{free} within libraries from continuing to use the library
-version of malloc, so if this is a problem, the compatibility issue
-needs to be dealt with in another way.
-
-
@node Functions, , Compatibility, Implementation
@section Function Descriptions
Given a @code{mmalloc} descriptor, if the last @code{mmalloc} operation
failed for some reason due to a system call failure, then
returns the associated @code{errno}. Returns 0 otherwise.
+(This function is not yet implemented).
@end table
@bye