reserve method of vector

Discussion in 'C Programming' started by George2, Nov 15, 2007.

  1. George2

    George2 Guest

    Hello everyone,


    I read MSDN document about reserve method of vector, but I can not
    find answers to the following 2 questions after reading it,

    1. if we reserve 10,000 size, will the memory actually be occupied
    10,000 size (like committed memory of Windows Virtual Memory
    management) or the memory will just be reserved for future use (like
    reserved memory of Windows Virtual Memory management);

    2. Will reserve method of vector improve performance? If yes, could
    anyone share some experiences please?

    If reserve method has any additional benefits beyond performance,
    please also let me know. :)


    thanks in advance,
    George
    George2, Nov 15, 2007
    #1
    1. Advertising

  2. George2 wrote:
    > Hello everyone,
    >
    >
    > I read MSDN document about reserve method of vector, but I can not
    > find answers to the following 2 questions after reading it,
    >
    > 1. if we reserve 10,000 size, will the memory actually be occupied
    > 10,000 size (like committed memory of Windows Virtual Memory
    > management) or the memory will just be reserved for future use (like
    > reserved memory of Windows Virtual Memory management);
    >
    > 2. Will reserve method of vector improve performance? If yes, could
    > anyone share some experiences please?
    >
    > If reserve method has any additional benefits beyond performance,
    > please also let me know. :)


    That's not C. Try comp.lang.c++.

    --
    Philip Potter pgp <at> doc.ic.ac.uk
    Philip Potter, Nov 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john smith

    vector.reserve

    john smith, Jul 25, 2003, in forum: C++
    Replies:
    5
    Views:
    690
    John Harrison
    Jul 25, 2003
  2. Alex Vinokur

    vector : reserve(LONG_MAX)

    Alex Vinokur, Apr 22, 2004, in forum: C++
    Replies:
    2
    Views:
    448
    Pete Becker
    Apr 22, 2004
  3. Matthias Kaeppler

    seg-fault on vector-auto-reserve

    Matthias Kaeppler, Feb 27, 2005, in forum: C++
    Replies:
    2
    Views:
    463
    Victor Bazarov
    Feb 27, 2005
  4. Gary Kuehn
    Replies:
    2
    Views:
    459
    Gary Kuehn
    Jul 19, 2005
  5. Replies:
    8
    Views:
    1,914
    Csaba
    Feb 18, 2006
Loading...

Share This Page