I have recently started using fragments have created a demo app which looks like this:

C
The FragmentManager does it's own memory management. It will kill/recreate or keep in memory your instances according to its logic. You can ensure your fragment's state is save using onSaveInstanceState()
Or you can for force the system to keep your instance alive using setRetainInstance(true) on your Fragment.
This is how you create a transaction.
FragmentTransaction fragmentTransaction = context.getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.layout, new MyFragment(), f.getClass().getName());
fragmentTransaction.commit();