J
Jeremy Lemaire
Hello,
I am working on cross platform code that is displaying a huge memory
leak when compiled on 11.00 HPUX using the aCC -AA flag. It is not
leaking on NT, LINUX, Solaris, or HPUX without the -AA flag. In
another news group I came across some interesting (ok scarey)
information regarding memory leaks in the STL list<...> container. I
have compiled and executed the following code and verified that this
does in fact leak on my system.
#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
#include <list>
using namespace std;
template class list<int>;
int main (int argc, char *argv[])
{
list<int> list_int;
char c='r';
do
{
for ( int j = 0; j < 99999 ; j++ )
{
list_int.push_back(2);
list_int.pop_front();
}
printf ( "\nPress r to repeat, q to exit\n=>" );
c = getchar ();
}
while ( c != 'q' );
return 0;
}
STL is used throughout my code. Has anyone run into this problem? If
so could you please let me know if you have come up with a fix, patch,
or work-around. Any help would be greatly appreciated.
Regards,
Jeremy
I am working on cross platform code that is displaying a huge memory
leak when compiled on 11.00 HPUX using the aCC -AA flag. It is not
leaking on NT, LINUX, Solaris, or HPUX without the -AA flag. In
another news group I came across some interesting (ok scarey)
information regarding memory leaks in the STL list<...> container. I
have compiled and executed the following code and verified that this
does in fact leak on my system.
#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
#include <list>
using namespace std;
template class list<int>;
int main (int argc, char *argv[])
{
list<int> list_int;
char c='r';
do
{
for ( int j = 0; j < 99999 ; j++ )
{
list_int.push_back(2);
list_int.pop_front();
}
printf ( "\nPress r to repeat, q to exit\n=>" );
c = getchar ();
}
while ( c != 'q' );
return 0;
}
STL is used throughout my code. Has anyone run into this problem? If
so could you please let me know if you have come up with a fix, patch,
or work-around. Any help would be greatly appreciated.
Regards,
Jeremy