printmem debug function