/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* bos72X src/bos/usr/include/malloc.h 1.23.2.2 */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* COPYRIGHT International Business Machines Corp. 1985,2021 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ /* @(#)28 1.23.2.2 src/bos/usr/include/malloc.h, libcgen, bos72X, x2021_20A5 3/31/21 07:22:57 */ /* * COMPONENT_NAME: (LIBCGEN) Standard C Library General Functions * * FUNCTIONS: * * ORIGINS: 27 * * (C) COPYRIGHT International Business Machines Corp. 1985, 1994 * All Rights Reserved * Licensed Materials - Property of IBM * * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ #ifndef _H_MALLOC #define _H_MALLOC #include /* for size_t and uintptr_t */ #ifdef __cplusplus extern "C" { #endif /* Constants defining mallopt operations */ #define M_MXFAST 1 /* set size of blocks to be fast */ #define M_NLBLKS 2 /* set number of block in a holding block */ #define M_GRAIN 3 /* set number of sizes mapped to one, for small blocks */ #define M_KEEP 4 /* retain contents of block after a free until another allocation */ #define M_DISCLAIM 5 /* disclaim free'd memory */ #define M_MALIGN 6 /* set default allocation alignment */ /* structure filled by mallinfo */ struct mallinfo { unsigned long arena; /* total space in arena */ int ordblks; /* number of ordinary blocks */ int smblks; /* number of small blocks */ int hblks; /* number of holding blocks */ int hblkhd; /* space in holding block headers */ unsigned long usmblks; /* space in small blocks in use */ unsigned long fsmblks; /* space in free small blocks */ unsigned long uordblks; /* space in ordinary blocks in use */ unsigned long fordblks; /* space in free ordinary blocks */ int keepcost; /* cost of enabling keep option */ #ifdef SUNINFO int mxfast; /* max size of small block */ int nblks; /* number of small blocks in holding block */ int grain; /* small block rounding factor */ unsigned long uordbytes; /* space allocated in ordinary blocks */ int allocated; /* number of ordinary blocks allocated */ unsigned long treeoverhead; /* bytes used in maintaining in free tree */ #endif }; /* struct filled by mallinfo_heap */ struct mallinfo_heap { unsigned long root_sz; /* size of biggest free chunk in arena */ unsigned long acquired; /* total acquired storage including actual data overhead */ unsigned long blks_alloc; /* number of blocks alocated including the free tree */ unsigned long netalloc; /* heap space already malloced */ unsigned long bytes_free; /* total bytes in free tree */ }; #ifdef _NO_PROTO extern int mallopt(); extern struct mallinfo mallinfo(); extern struct mallinfo_heap mallinfo_heap(); #else /*_NO_PROTO */ extern int mallopt(int, int); extern struct mallinfo mallinfo(void); extern struct mallinfo_heap mallinfo_heap(int); #endif /*_NO_PROTO */ /************************************************************************* * Malloc Log *************************************************************************/ #define DEFAULT_RECS_PER_HEAP 4096 #define MAX_RECS_PER_HEAP 65535 #define DEFAULT_STACK_DEPTH 4 #define MAX_STACK_DEPTH 64 #ifndef MALLOC_LOG_STACKDEPTH #define MALLOC_LOG_STACKDEPTH DEFAULT_STACK_DEPTH #endif struct malloc_log { size_t size; /* size of the allocation */ size_t cnt; /* number of allocations that match this particular * size and stack traceback */ uintptr_t callers [MALLOC_LOG_STACKDEPTH]; /* stack traceback of the allocation */ }; size_t get_malloc_log (void *, void *, size_t); struct malloc_log * get_malloc_log_live (void *); void reset_malloc_log (void * addr); #if !defined(__xlC__) || defined(__ibmxl__) || defined(__cplusplus) #if defined(__IBMCPP__) && !defined(__ibmxl__) extern "builtin" char *__alloca (size_t); # define alloca __alloca #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) #undef alloca #define alloca(size) __builtin_alloca (size) #endif #endif /* !defined(__xlC__) || defined(__ibmxl__) || defined(__cplusplus) */ #ifdef __cplusplus } #endif #endif /* _H_MALLOC */