title: Static singleton class memory leak in android
body: <p>I have a static singleton class that extends my User object:</p>
  
  <pre><code>public class TestSingleton extends User{
  
      private static TestSingleton singletonInstance;
  
      private TestSingleton() {
      }
  
      public static TestSingleton getObj() {
          if (singletonInstance == null) {
              singletonInstance = new TestSingleton();
          }
          return singletonInstance;
      }
  }
  </code></pre>
  
  <p>The purpose of the singleton is to avoid create new instance any time i want to use my User object in different activities:</p>
  
  <pre><code>TestSingleton test = new TestSingleton();
  test.doSomthing();
  </code></pre>
  
  <p>And to write it on one line and create instance only one time in my app life cycle:</p>
  
  <pre><code>TestSingleton.getObj().doSomthing();
  </code></pre>
  
  <p>My question is:</p>
  
  <p>Is this use of static Singleton create memory leak and hold reference to any activity I use the singleton?</p>
  
  <p>Is it safe to use? or there is a better solution?</p>