add test for the inmemory_dictionary_manager, fix memory leaks along the way