mem implementation