* Copyright (c) 1983, 1991, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)alloc.c 8.1 (Berkeley) %G%";
char *memtop
= NULL
; /* PWP: top of current memory */
char *membot
= NULL
; /* PWP: bottom of allocatable memory */
memtop
= membot
= sbrk(0);
if ((ptr
= malloc(n
)) == (ptr_t
) 0) {
memtop
= membot
= sbrk(0);
if ((ptr
= realloc(p
, n
)) == (ptr_t
) 0) {
memtop
= membot
= sbrk(0);
if ((ptr
= calloc(s
, n
)) == (ptr_t
) 0) {
* mstats - print out statistics about malloc
* Prints two lines of numbers, one showing the length of the free list
* for each size category, the second showing the number of mallocs -
* frees for each size category.
memtop
= (char *) sbrk(0);
(void) fprintf(cshout
, "Allocated memory from 0x%lx to 0x%lx (%ld).\n",
(unsigned long) membot
, (unsigned long) memtop
, memtop
- membot
);