* C++ Bug? STL associative containers (map, set, ...)
@ 1997-04-05 5:00 Twilger
0 siblings, 0 replies; only message in thread
From: Twilger @ 1997-04-05 5:00 UTC (permalink / raw)
I am having a problem with a memory leak when I use one of the associative
containers such as map or set in the Standard Template Library. This
problem occures on a Digital Alpha running Digital Unix 3.2D-1 and DEC C++
5.4. Actually, it's more like a river than a leak! The problem occures
when I have a class which contains more than one instance of a particular
associative container.
Exmaple:
class foo
{
map<int, int, less<int> > x1;
map<int, int, less<int> > x2;
};
int main()
{
foo *pMyfoo;
while (1)
{
pMyfoo = new foo();
delete pMyfoo;
}
}
When I run this, even though I call delete on pMyfoo, the memory being
used is not getting completely released, eventually causing the program to
run out of heap. If I change the class foo to have only one instance of a
map, the problem goes away. Also, when I use other containers such as
vector or deque in place of map, I don't have any problems. I tried to
replicate this problem using Visual C++ 4.2 on an Intel machine, but it
worked fine. Does anybody have an idea what is going on?
I am not always able to check this news group :(
if you can answer this could you send the response to:
tom.wilger@coors.com
Thanks
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-04-05 5:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-05 5:00 C++ Bug? STL associative containers (map, set, ...) Twilger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox