}
}
+void
+resetMemoryContext(MemoryContext *cntx) {
+ MemoryChunk *chunk, *chunkptr;
+
+ while( cntx ) {
+ chunkptr = cntx->chunk;
+ chunkptr->freesize = chunkptr->size;
+ chunkptr = chunkptr->next;
+ cntx->chunk->next = NULL;
+
+ while( chunkptr ) {
+ chunk=chunkptr->next;
+ tfree(chunkptr);
+ chunkptr=chunk;
+ }
+ cntx=cntx->child;
+ }
+}
+
void*
mcalloc(MemoryContext *cntx, size_t size) {
MemoryChunk *chunk = cntx->chunk;
MemoryContext *allocMemoryContext(MemoryContext* parent, int flags);
void freeMemoryContext(MemoryContext* cntx);
+void resetMemoryContext(MemoryContext* cntx);
void* mcalloc(MemoryContext *cntx, size_t size);
void* mc0alloc(MemoryContext *cntx, size_t size);
void* mcrealloc(void * ptr, size_t size);