Hi folks, I've been working on resolving memory leaks detected by ASan in our unit tests and identified a significant issue with our current approach to test instance generation. Current Problem: Our generate_test_instance() function returns std::list<T*> for types that support encoding/decoding. While this works functionally, it creates memory management issues because: - The lifecycle of generated test instances is inconsistently managed - Callers don't always properly clean up allocated memory - This results in numerous ASan memory leak reports in both unit tests and ceph-dencoder Proposed Solution: I propose we modify the function to return std::list<std::shared_ptr<T>> instead of raw pointers. This change would: - Automatically handle memory cleanup through RAII - Work correctly with types that lack move constructors - Eliminate the memory leaks we're currently seeing when testing with ASan enabled - Require updates to calling code, but provide cleaner memory semantics I considered adding suppression rules for the affected tests and ceph-dencoder, but that would only mask the underlying issue rather than properly addressing the memory management problem. Next Steps: If this approach sounds reasonable, I can prepare a patch that implements this change along with the necessary caller updates. What are your thoughts on this approach? Are there any concerns or alternative solutions you'd like to consider? -- Regards Kefu Chai