add memory monitoring