Correctly disposing SPSite and SPWeb in the context of SharePoint 2007, 2010, 2013 and 2016

Check these two links, they contain very relevant info:
https://blogs.technet.microsoft.com/stefan_gossner/2008/12/05/disposing-spweb-and-spsite-objects/ https://solutionizing.net/2008/12/06/the-new-definitive-spsitespweb-disposal-article/