Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > reserve method of vector

Reply
Thread Tools

reserve method of vector

 
 
George2
Guest
Posts: n/a
 
      11-15-2007
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
 
Reply With Quote
 
 
 
 
Philip Potter
Guest
Posts: n/a
 
      11-15-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
seg-fault on vector-auto-reserve Matthias Kaeppler C++ 2 02-27-2005 10:01 PM
how the vector is created, how to pass vector to webservices method apachesoap:Vector Rushikesh Joshi Perl Misc 0 07-10-2004 01:04 PM
vector : reserve(LONG_MAX) Alex Vinokur C++ 2 04-22-2004 02:33 PM
vector.reserve john smith C++ 5 07-25-2003 06:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57