server: add memory leak detection