Re: [Dev-C++] memory allocation with STL list
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: andrew.isaverdian <and...@at...> - 2003-02-20 17:29:14
|
Pablo:
It is weird. I was able to reproduce the problem initially.
=20
However, now it is gone.
The memory allocation works fine (it is being freed before "return") =
both in "debug" and "release" modes. (Windows 2000, Dev-C++ with gcc =
3.2).
=20
The build with VC++.NET works OK but very slow ( 3 sec before =
"Press..." message).
Andrew
----- Original Message -----=20
From: Pablo=20
To: dev...@li...=20
Sent: Wednesday, February 19, 2003 9:25 AM
Subject: [Dev-C++] memory allocation with STL list
I have a problem with the list template from the STL, illustrated in =
the following simple code:
#include <iostream>
#include <stdlib.h>
#include <list>
using namespace std;
=20
void f()
{
list<double> l;
for (int i=3D0; i<1000000;i++) l.push_back(i);
}
=20
int main()
{
f();
system("PAUSE");
return 0;
}
The code compiles and runs ok with Dev C++, but the problem is that =
the memory used by the list remains allocated, even when the object is =
no longer accessible (at the "pause" prompt).=20
This does not happen with other STL templates (deque, vector,...) =
under Dev C++, neither with lists under Borland compilers.
Does anyone know how to address this?
Thanks in advance for your help.
|