8cc7dee111a52eed9f6e65a01e67730af13b43b4 braney Thu Jun 6 15:30:22 2019 -0700 ongoing work on trackDb caching in shared memory diff --git src/inc/localmem.h src/inc/localmem.h index 3b8231e..af9339c 100644 --- src/inc/localmem.h +++ src/inc/localmem.h @@ -16,33 +16,39 @@ * pass in zero and a reasonable default will be used. */ struct lm *lmInitWMem(void *mem, int blockSize); /* Create a local memory pool. Don't do any memory allocation. Parameters are: * mem -- the memory to use for the blocks * blockSize - how much memory has been allocated. If this is exhausted, an errAbort occurs. */ void lmCleanup(struct lm **pLm); /* Clean up a local memory pool. */ size_t lmAvailable(struct lm *lm); // Returns currently available memory in pool +size_t lmUsed(struct lm *lm); +// Returns amount of memory allocated + size_t lmSize(struct lm *lm); // Returns current size of pool, even for memory already allocated +unsigned int lmBlockHeaderSize(); +// Return the size of an lmBlock. + void *lmAlloc(struct lm *lm, size_t size); /* Allocate memory from local pool. */ void *lmAllocMoreMem(struct lm *lm, void *pt, size_t oldSize, size_t newSize); /* Adjust memory size on a block, possibly relocating it. If block is grown, * new memory is zeroed. NOTE: in RARE cases, same pointer may be returned. */ void *lmCloneMem(struct lm *lm, void *pt, size_t size); /* Return a local mem copy of memory block. */ char *lmCloneStringZ(struct lm *lm, const char *string, int size); /* Return local mem copy of string of given size, adding null terminator. */ char *lmCloneString(struct lm *lm, const char *string);