incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Happel" <phap...@quovadx.com>
Subject std::vector intialization on HP-UX
Date Wed, 23 May 2007 16:28:32 GMT
Hello all,
  I'm working with versions 4.1.2 and 4.1.0 of the STDCXX on HP-UX 11i
with aCC 3.63, and I've noticed that when a std::vector is constructed
with a size parameter, it's actually allocated as that size + 32
additional elements.  For example:
 
#include <iostream>
#include <vector>
 
int main() {
 std::vector<long> testvec1(4);
 std::cout << "Capacity: " << testvec1.capacity() << std::endl;
 std::cout << "Size: " << testvec1.size() << std::endl;
 return 0;
}
 
  When run will output:
 
[phappel@moe 15d]$ ./stdvectest 
Capacity: 36
Size: 4
 
  The HP-UX Standard Library will allocate 32 element sizes to a vector
declared with a size less than 32, but will allocate as expected beyond
that.  STDCXX, however, seems like it will always add 32 to the size.
I'm curious if there is an explanation for this - is it perhaps some
quirk of memory allocation or template instantiation on HP-UX?  Any
insight would be appreciated!
 
Thanks,
 -Patrick Happel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message