Is the behavior similar to the way Activities work? For example with Activities it works like this:
Activity A starts Activity B, while B is on screen, the system is able to remove A from memory if it is needed by the system. Upon pressing BACK, A will be recreated into memory as if it never left in the first place.
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:
Activity C has Fragment F in its layout. Then, at some point F is replaced by Fragment G, but F is kept in its back stack.
Will F stay in memory until the C is killed or can it be removed by the system as needed?
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?