Make distructor virtual for class with virtual function (#26504)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26504
[pytorch] [distributed] Make distructor virtual for class with virtual function
Not having virtual distructor may lead to a memory leak.
ghstack-source-id: 90454880
Test Plan: Made sure pg based UT works.
Differential Revision: D17488876
fbshipit-source-id: 5fdc55e175fd2b22e931b740c36cb1feed454066