add memory monitor fn