From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <102653680322067.tru64-unix-managers.marc@archive.invalid> From: "Price, Richard \(REO\)" Date: Fri, 21 Sep 2001 14:57:23 +0000 To: tru64-unix-managers Subject: C++ Compiler STL problem X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=102653680322067 > Hello, > > We are experiencing STL (Standard Template Library) memory problems after > porting code from Compaq C++ 5.7-002 to V6.1-029 running on Tru64 V4.0F > Patch DUV40FAS0004. > > After initial investigation the problem had been isolated to the > implementation of STL (Standard Template Library) in the V6.1 compiler > (maybe later versions as well). > > I have produced a simple test program to demonstrate this. It can clearly > be seen that under certain conditions the code compiled under the new > compiler can take up as much as 13 times the amount of memory to run the > same executable, and that memory allocation is very dependent on how STL > is used and in what order memory is allocated within the sample program. > (Try changing the order that vectors, sets and lists are allocated in the > sample program, the results are very different.) > > I have tried replacing the STL /usr/include/cxx on the V6.1 machine with > STL from the 5.7 environment. When the test program was compiled an run, > the problem disappeared. Thus the problem appears to be in the > Compaq/RogueWave implementation of STL. > > Regards, > > Richard Price > > > P.S Test program attached to demonstrate the problem. > > > #include > #include > #include > > #include > #include > #include > #include > > //using namespace std; > > int memuse () { > > int status = 0; > struct rusage ru; > status = getrusage(RUSAGE_SELF,&ru); > > //printf("Process: user time = %d\n",ru.ru_utime); > //printf("Process: system time = %d\n",ru.ru_stime); > //printf("Process: integral shared memory size = %d\n",ru.ru_ixrss); > > printf("Process: integral unshared data = %d\n",ru.ru_idrss); > > //printf("Process: integral unshared stack = %d\n",ru.ru_isrss); > //printf("Process: Page faults = %d\n",ru.ru_majflt); > > struct timeval rtime = ru.ru_utime; > return rtime.tv_usec; > > } > > main() { > int i; > > int status; > printf("Main: Start\n"); > int mem = memuse(); > printf("\n\n"); > > printf("Main: Create vector set\n"); > vector< set > test(10000); > mem = memuse(); > printf("\n\n"); > > for(i = 0; i < 10000; ++i) test[i].insert(i/3); > printf("Main: Populated vector set\n"); > mem = memuse(); > printf("\n\n"); > > vector test2(100000); > printf("Main: Created vector ints\n"); > mem = memuse(); > printf("\n\n"); > > printf("Main: Populated vector ints\n"); > for(i = 0; i < 100000; ++i) test2.push_back(i); > > mem = memuse(); > printf("\n\n"); > > list test_list(100000); > printf("Main: Created list ints\n"); > mem = memuse(); > printf("\n\n"); > > printf("Main: Populated list ints\n"); > for(i = 0; i < 100000; ++i) test_list.push_back(i); > > mem = memuse(); > printf("\n\n"); > > > status = sleep(60); > > }