bytes_palloced | free_mem | mega_mem_calls | set_max_megs |
disable_max_megs | get_cmem | megs_malloced | set_max_megs_proc |
enable_max_megs | get_mem | memory_report | tp_alloc |
int bytes_palloced(void);How many bytes have been allocated by the palloc() routine? This includes all of the get_mem() calls.
void disable_max_megs(void);
void enable_max_megs(void);
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.
/* The following definitions exist because the memory get/free routines measure memory by pointers instead of bytes. */ #define CEILING(n,d) ((n)%(d) == 0 ? (n)/(d) : (n)/(d) + 1) #define BYTES_POINTER sizeof(void *) /* bytes per pointer */ #define PTRS(n) CEILING(n, BYTES_POINTER) /* ptrs needed for n bytes */