Made SimpleMemoryCheck thread-safe

Switched SimpleMemoryCheck to use the new Service APIs. In addition, switched to using std::atomics for thread safety. The module was changes so that if a callback is made while another callback is updating the memory measurement, the second callback just returns immediately.