Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7672861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:22:53+00:00 2026-05-31T16:22:53+00:00

I am aware that the size of a pointer is fixed (not the size

  • 0

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??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:22:54+00:00Added an answer on May 31, 2026 at 4:22 pm

    my_data will occupy sizeof(std::vector<data*>*) bytes, and no more than sizeof(void*).

    *my_data will occupy sizeof(std::vector<data*>), which can be as little as 3 * sizeof(data**), i.e. no more than 3 * sizeof(void*).

    *my_data will manage sizeof(data*) * my_data->capacity() bytes of dynamic memory.


    I have grave doubts that that information will be useful in practice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array, called x, whose size is 6*sizeof(float). I'm aware that declaring:
I'm aware that Python 3 fixes a lot of UTF issues, I am not
I am aware that memory allocation is not explicitly required in Java , as
I am aware that the specification of the C language does not dictate the
Firstly, whilst I'm aware that gzipping HTML would probably have as much (more?) of
I'm using Visual Studio 2008. I'm aware that std::vector has bounds checking with the
I'm aware that I could use something called std::vector , but I'm afraid it's
Yes i am aware that this is not something to relay on since it
I am aware that Android prefers nine-patch images as solution for all resolution/size screens.
I have a class that adapts std::vector to model a container of domain-specific objects.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.