porting mem test from hack-malloc (add memtest.c)