Home Dashboard Directory Help

inserting in a std::vector of std::string causes memory leak by RAB36


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 564917
Opened: 6/3/2010 2:54:25 AM
Access Restriction: Public
User(s) can reproduce this bug


The following program (win32 console application) reports a memory leak at application exit:

#include "stdafx.h"

#include <string>
#include <vector>

int _tmain(int argc, _TCHAR* argv[])
    // debug memory leaks

        std::vector<std::string> vec;

        vec.insert(vec.begin(), 2, "2");

    return 0;

The same program does not report a leak in VS 2008.
Sign in to post a comment.
Posted by Microsoft on 7/5/2011 at 10:06 AM
Yes, this was also FIXED in VC10 SP1, with the same change that was applied to VC11. There are NO known memory leaks in VC10 SP1's STL.

Stephan T. Lavavej
Posted by Dilip_K_R on 7/5/2011 at 8:35 AM
I can't seem to reproduce this leak on VS 2010 SP1. Stephan's comment below indicates this fix will be available only in VC 11. Was it retroactively fixed in SP1 too?
Posted by Microsoft on 6/22/2010 at 2:54 PM

Thanks for reporting this bug, and extra special thanks for the extremely small test case. We've fixed it, and the fix will be available in VC11.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 6/3/2010 at 8:02 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/3/2010 at 5:02 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.