cb63a575751c4a60e48340bd320934cccb053f75 braney Wed May 29 13:14:08 2019 -0700 some tweaks to the lm allocater to allow it to use a memory block passed into rather than allocating its own memory. Also a checkpoint routine for the memory allocators that allows a caller to find out how much memory has been allocated since the last time it was called. diff --git src/inc/common.h src/inc/common.h index 6d4018a..64b71fa 100644 --- src/inc/common.h +++ src/inc/common.h @@ -164,30 +164,33 @@ #endif /* Cast a pointer to a long long. Use to printf format points as long-longs * in a 32/64bit portable manner. Format should use %llx for the result. * Needed because casting a pointer to a different sized number cause a * warning with gcc */ #define ptrToLL(p) ((long long)((size_t)p)) /* How big is this array? */ #define ArraySize(a) (sizeof(a)/sizeof((a)[0])) #define uglyf printf /* debugging printf */ #define uglyAbort errAbort /* debugging error abort. */ #define uglyOut stdout /* debugging fprintf target. */ +unsigned long memCheckPoint(); +/* Return the amount of memory allocated since last called. */ + void *needMem(size_t size); /* Need mem calls abort if the memory allocation fails. The memory * is initialized to zero. */ void *needLargeMem(size_t size); /* This calls abort if the memory allocation fails. The memory is * not initialized to zero. */ void *needLargeZeroedMem(size_t size); /* Request a large block of memory and zero it. */ void *needLargeMemResize(void* vp, size_t size); /* Adjust memory size on a block, possibly relocating it. If vp is NULL, * a new memory block is allocated. Memory not initted. */