tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Price, Richard \(REO\)" <RPrice () Compaq ! com>
To: tru64-unix-managers
Subject: C++ Compiler STL problem
Date: Fri, 21 Sep 2001 14:57:23 +0000	[thread overview]
Message-ID: <102653680322067.tru64-unix-managers.marc@archive.invalid> (raw)


> 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 <unistd.h>
> #include <sys/time.h>
> #include <sys/resource.h>
> 
> #include <list>
> #include <vector>
> #include <map>
> #include <set>
> 
> //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<int> > 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<int> 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<int> 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);
> 
> }

                 reply	other threads:[~2001-09-21 14:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox