title: Singleton instance freeing
body: <p>I have such singleton structure:</p>
  
  <pre><code>// Hpp
  class Root : public boost::noncopyable
  {
      public:
          ~Root();
  
          static Root &amp;Get();
  
          void Initialize();
          void Deinitialize();
  
      private:
          Root();  // Private for singleton purposes
          static Root *mInstance;
  
          Manager1 *mManager1;
          Manager2 *mManager2;
  };
  
  
  // Cpp
  Root *Root::mInstance = nullptr;
  
  Root::Root()
  {
      mInstance = this;
  
      // Managers are using `mInstance` in their constructors
      mManager1 = new Manager1();
      mManager2 = new Manager2();
  
      mInstance-&gt;Initialize();
  }
  
  Root::~Root() { delete mManager1; delete mManager2; }
  
  Root &amp;Root::Get()
  {
      if (mInstance == nullptr) mInstance = new Root();
      return *mInstance;
  }
  
  void Root::Deinitialize()
  {
      delete mInstance;
  }
  </code></pre>
  
  <p>And here is the usage of this singleton:</p>
  
  <pre><code>Root::Get();
  // Some code calling related to mManager1 and mManager2
  Root::Get().Deinitialize();
  </code></pre>
  
  <p>The questions are:</p>
  
  <ul>
  <li>This is memory safely to use such singleton structure?</li>
  <li>How can I automate deletion of <code>mInstance</code> (call dtor manually). Because the user could forget to call <code>Deinitialize()</code> method.</li>
  </ul>