memchunk.c - almost finalized