#include "memory.h"

This page has information from files memory.h and memory.c.

Contents


Public Routines in File memory.c

Index

bytes_pallocedget_memmemory_reporttp_alloc
free_memmega_mem_callsset_max_megs
get_cmemmegs_mallocedset_max_megs_proc

Details


int bytes_palloced(void);
How many bytes have been allocated by the palloc() routine? This includes all of the get_mem() calls.
void free_mem(void *q, unsigned n);
Free a chunk of memory that holds n pointers (not n bytes) that was returned from a previous get_mem() or get_cmem() call.
void *get_cmem(unsigned n);
Get a chunk of memory that will hold n pointers (NOT n BYTES). The memory is initialized to all 0.
void *get_mem(unsigned n);
Get a chunk of memory that will hold n pointers (NOT n BYTES). The memory is NOT initialized.
unsigned mega_mem_calls(void);

int megs_malloced(void);
This routine returns the number of megabytes that palloc() has obtained from the operating system by malloc();
void memory_report(FILE *fp);

void set_max_megs(int megs);
This routine changes the limit on the amount of memory obtained from malloc() by palloc(). The argument is in megabytes. The default value is DEFAULT_MAX_MEGS.
void set_max_megs_proc(void (*proc)(void));
This routine is used to specify the routine that will be called if max_megs is exceeded.
void *tp_alloc(size_t n);
Allocate n bytes of memory, aligned on a pointer boundary. The memory is not initialized, and it cannot be freed.

Public Definitions in File memory.h

#define BYTES_POINTER   sizeof(void *)  /* bytes per pointer */
#define CEILING(n,d)    ((n)%(d) == 0 ? (n)/(d) : (n)/(d) + 1)


Introduction


These activities are projects of the Mathematics and Computer Science Division of Argonne National Laboratory.