There are two questions here :-
1. When will view controller of A be deallocated in the memory?
Answer
When you'll remove it from the stack of view controller without maintaining a reference to it for example if it's a Root View Controller then you'll have change the Root view controller of the window object, If its in a navigation stack you have to pop the view controller from the navigation stack and if you have manually presented it you need to dismiss the view controller.
2. Can I still accessed the content in view controller of A in the view controller of B?
Answer
Yes, You can by passing the value of the view controller whether you're doing it by Segue, by pushing it in navigation controller or when you're presenting it but that will limit you to pass data only when your moving to A -> B view controller.
However I would like to suggest you to create protocols and delegates to communicate between two view controllers.
This link will demonstrate all means of passing data between view controllers. I hope this information was helpful to you. Thanks