I am aware that the size of a pointer is fixed (not the size of the data it points to). Now given that, supposing I have a vector of data in global scope and I declare a pointer to a vector of pointers to some/all of that global data, how much memory will this additionally use (RAM)? I am totally at a loss here and would certainly appreciate some ideas/advice. I am hoping that the additional memory consumption would be just the size of vector times the fixed size of a pointer (say, 8 bytes) regardless of the complexity of the data; since the data it points to exists in global scope (i.e., no new data is being allocated; hope I've explained my thoughts clearly).
Some pseudo code that expresses my question would look like:
std::vector<data> global_data;
std::vector<data*>* my_data = new std::vector<data*>(); //-Is this even valid?
//-Now populate the vector with pointers to data in global_data
for(int i=0; i<global_data.size(); ++i) {
my_data->push_back(&global_data[i]);
}
Then my question is how much additional memory in RAM (i.e., in excess of what's already in use from creating global_data) is used up by m_data??