From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,2d5e64074305acf3,start X-Google-Attributes: gid1164f8,public From: twilger@aol.com (Twilger) Subject: C++ Bug? STL associative containers (map, set, ...) Date: 1997/04/05 Message-ID: <19970405165400.LAA08133@ladder01.news.aol.com>#1/1 X-Deja-AN: 230938338 Organization: AOL http://www.aol.com Newsgroups: comp.sys.dec X-Admin: news@aol.com 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 > x1; map > 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