test for memory leak with shared_ptr so that valgrind is not necessarily required