porting mem test from hack-malloc