Refactored the memory pool implementation into a result_set class.