





            


                    MMeemmMMggrr ---- AA SSiimmppllee MMeemmoorryy MMaannaaggeemmeenntt LLiibbrraarryy
                                    RReelleeaassee 11..0022


                                    _P_a_u_l _D_u_B_o_i_s
                              _d_u_b_o_i_s_@_p_r_i_m_a_t_e_._w_i_s_c_._e_d_u
                     Wisconsin Regional Primate Research Center
                          Revision date:  25 October 1991


            11..  IInnttrroodduuccttiioonn

            MemMgr is a fairly trivial memory management library.  There
            is little it does that cannot be done using routines in  the
            C library.  (In fact, allocation and disposal is implemented
            using C library routines.)  The purposes of MemMgr are  two-
            fold.

            (i)  Minimize  configuration  burden  on  applications  that
                 dynamically allocate memory.  For instance, malloc() on
                 some  systems  returns  a  char  pointer;  on others it
                 returns a void pointer.  The  MemMgr  library  routines
                 encapsulate  system-specific  configuration differences
                 and exports a fixed interface which is  system-indepen-
                 dent.  Once you compile and install it, you just use it
                 without thinking about whether your UNIX is System V or
                 BSD inspired.

            (ii) Provide  two parallel sets of allocation routines which
                 either return NULL  (for  applications  which  want  to
                 check)  or panic (for applications which simply want to
                 die) on allocation failures.  Panicking is  implemented
                 using the ETM library, which introduces a dependency on
                 the ETM distribution.  So be it.  I use ETM for all  my
                 programs anyway.

            22..  IInnssttaallllaattiioonn

            This  release  of  MemMgr  is configured using imake and the
            standard WRPRC multiple-project configuration files, so  you
            also  need  to  obtain  the WRPRC configuration distribution
            (version 1.03 or higher) if you want to build it  the  usual
            way.   (If  you  want to avoid imake, the Makefile is simple
            enough that you should be able to tweak it by hand.)

            You also need to obtain and install  the  Exception/Termina-
            tion Manager (ETM) library to build this distribution.

            If you are using imake, take a look at the files in the con-
            fig directory and change things if you want.  Then build the
            distribution with ``make World'' or:



            Revision date:  25 October 1991       Printed:  10 May 19120





            Memory Manager Library      - 2 -


                 make Bootstrap
                 make depend
                 make
                 make install


            33..  PPrrooggrraammmmiinngg IInntteerrffaaccee

            Source  files  for applications using MemMgr routines should
            include memmgr.h.

            Applications using MemMgr should  be  linked  with  -lmemmgr
            -letm.

            cchhaarr **AAllllooccNNPP ((ssiizzee))
            iinntt     ssiizzee;;

            Allocate size bytes of memory and return a pointer to it, or
            NULL if insufficient memory is available.  The memory is not
            guaranteed to be zeroed.

            cchhaarr **AAlllloocc ((ssiizzee))
            iinntt     ssiizzee;;

            Like  Alloc(), but panics if insuffient memory is available.

            cchhaarr **SSttrrAAllllooccNNPP ((ss))
            cchhaarr    **ss;;

            Allocates space for the string pointed to by s (including  a
            null  byte  at  the  end),  copies  the  string into it, and
            returns a pointer to the copy.  Returns NULL if s is NULL or
            insufficient memory is available.

            cchhaarr **SSttrrAAlllloocc ((ss))
            cchhaarr    **ss;;

            Like  StrAllocNP(),  but  panics  if s is NULL or insuffient
            memory is available.

            cchhaarr **VVAAllllooccNNPP ((ccoouunntt,, ssiizzee))
            iinntt     ccoouunntt,, ssiizzee;;

            Allocate count objects of size bytes of memory and return  a
            pointer  to it, or NULL if insufficient memory is available.
            The memory is not guaranteed to be zeroed.

            cchhaarr **VVAAlllloocc ((ccoouunntt,, ssiizzee))
            iinntt     ccoouunntt,, ssiizzee;;

            Like VAlloc(), but panics if insuffient memory is available.






            Revision date:  25 October 1991       Printed:  10 May 19120





                                        - 3 -     Memory Manager Library


            cchhaarr **RReeaallllooccNNPP ((pp,, ssiizzee))
            cchhaarr    **pp;;
            iinntt     ssiizzee;;

            Reallocate  the  block  of memory pointed to by p to be size
            bytes long, free p and return a pointer to the new block.  p
            should  have  been allocated by one of the other MemMgr rou-
            tines.  Returns NULL if insufficient memory is available; in
            this  case  the  block  pointed  to by p is nnoott freed.  Also
            returns NULL if p is NULL.

            cchhaarr **RReeaalllloocc ((pp,, ssiizzee))
            cchhaarr    **pp;;
            iinntt     ssiizzee;;

            Like Realloc(), but panics if p is NULL or insuffient memory
            is available.

            vvooiidd FFrreeee ((pp))
            cchhaarr    **pp;;

            Frees the chunk of memory pointed to by p; the memory should
            have been allocated by one of  the  other  MemMgr  routines,
            with the exception that it is safe to pass NULL to Free().

            44..  DDiissttrriibbuuttiioonn aanndd UUppddaattee AAvvaaiillaabbiilliittyy

            The  MemMgr  distribution  may  be  freely circulated and is
            available for anonymous FTP access under the ~ftp/pub direc-
            tory  on host ftp.primate.wisc.edu.  Updates appear there as
            they become available.

            The ETM and WRPRC configuration distributions are  available
            on ftp.primate.wisc.edu as well.

            If  you do not have FTP access, send requests to the address
            software@primate.wisc.edu.  Bug reports, questions,  sugges-
            tions and comments may be sent to this address as well.



















            Revision date:  25 October 1991       Printed:  10 May 19120


