title: Is it ok to skip delete for a dynamically-allocated static member variable?
body: <p>Is it fine to define a static member variable as a newed object and never delete it? For example</p>
  
  <pre><code>class A
  {
      static vector&lt;BaseClass*&gt; p;
  };
  
  vector&lt;BaseClass*&gt; A::p = vector&lt;BaseClass*&gt;{new DerivedClassA, ...};
  </code></pre>
  
  <p>I think there is no memory leakage problem because p is static, its life cycle is over the whole program and its memory will be released by the operating system when the program is terminated. Its memory behavior seems almost similar to the following</p>
  
  <pre><code>class A
  {
      static vector&lt;unique_ptr&lt;BaseClass&gt;&gt; p;
  };
  
  vector&lt;unique_ptr&lt;BaseClass&gt;&gt; A::p = ...;
  </code></pre>
  
  <p>But I am not sure if I am right or not.</p>