i am using B.11.11 with HP aC++ Compiler (S800) C.03.37.01.
---------------------------------------------------------------------------------------------------
#include <string>
#include <iostream>
int main()
{
std::string test;
printf("test size: %d\n",test.capacity());
test = "becks";
printf("test size: %d length: %d
\n",test.capacity(),test.length());
}
---------------------------------------------------------------------------------------------------
bash-2.05b# aCC -AA simple.cpp
bash-2.05b# ./a.out
test size: 0
test size: 128 length: 5
the same program ran on linux gave me
test size: 0
test size: 5 length: 5
if the program is pretty much string intensive this will result high
memory usage in HPUX.
any suggestions or comments on how to reduce the default capacity
size? do we have any compiler options to deal which this?
thanks
bekz
> bash-2.05b# aCC -AA simple.cpp
> bash-2.05b# ./a.out
> test size: 0
> test size: 128 length: 5
$ aCC -AA junk.cpp -D_RWSTD_MINIMUM_STRING_CAPACITY=10 && ./a.out
test size: 0
test size: 10 length: 5
$ aCC -AA junk.cpp -D_RWSTD_MINIMUM_STRING_CAPACITY=1 && ./a.out
test size: 0
test size: 5 length: 5
> if the program is pretty much string intensive this will result high
> memory usage in HPUX.
Only if you have a lot of very short strings.
Even then, you are probably guilty of premature optimization.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
but i didn't understand what you meant by permature optimzaiton...how
can optimization affect this? do you mean compiler changing back the
string capacity to some different value other than zero?
bekz
On Nov 1, 11:52 am, Paul Pluzhnikov <ppluzhnikov-...@charter.net>
wrote:
Nothing to do w/ compiler optimization settings. see:
<http://en.wikipedia.org/wiki/
Optimization_(computer_science)#When_to_optimize>
_RWSTD_MINIMUM_STRING_CAPACITY is documented in:
http://docs.hp.com/en/10946/libs.htm#container_alloc
>>> if the program is pretty much string intensive this will result high
>>> memory usage in HP-UX.
If you are using -mt, there is more space wasted.