title: When a Fragment is replaced and put in the back stack (or removed) does it stay in memory?
body: <p>Is the behavior similar to the way Activities work?  For example with Activities it works like this:</p>
  
  <p><strong>Activity A</strong> starts <strong>Activity B</strong>, while <strong>B</strong> is on screen, the system is able to remove <strong>A</strong> from memory if it is needed by the system.  Upon pressing BACK, <strong>A</strong> will be recreated into memory as if it never left in the first place.</p>
  
  <p>I have looked for a clear explanation of what happens memory wise with Fragments and haven't found anything.  Does it work the same way?  For example:</p>
  
  <p><strong>Activity C</strong> has <strong>Fragment F</strong> in its layout.  Then, at some point <strong>F</strong> is replaced by <strong>Fragment G</strong>, but <strong>F</strong> is kept in its back stack.</p>
  
  <p>Will <strong>F</strong> stay in memory until the <strong>C</strong> is killed or can it be removed by the system as needed?</p>
  
  <p><em>Really what I am asking is whether or not I run the risk of running out of memory if I have a back stack of complicated Fragments in a single Activity?</em></p>