add up macro CHECK_M for checking memery is valid