Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1079479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:52:34+00:00 2026-05-16T21:52:34+00:00

The attached, trivial, test program tests the performance of emptying a simple std::map. Using

  • 0

The attached, trivial, test program tests the performance of emptying a simple std::map. Using MSVC 2008 and 2010, the debug build will take <30seconds when executed from a command prompt but almost 3 minutes when executed from within the debugger. The call to clear() is entirely responsible for the difference. If I break into the debugger the callstack will always point to HeapFree.
Question: Why the huge difference? Can I somehow change debug heap settings so it’ll be fast when executed in the debugger?

#include <map>

int
main ( int, char )
{
    std::map< time_t, double > test;
    for ( int i = 0; i < 1000000; ++i )
    {
        test[i] = i / 3.14;
    }
    test.clear();
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:52:35+00:00Added an answer on May 16, 2026 at 9:52 pm

    Trying setting the environment variable _NO_DEBUG_HEAP=1 in the program’s initial environment. This disables Windows’ internal debug heap, which might make it harder to debug memory corruption problems.

    This KB article mentions the flag, and you can infer that the default (low-fragmentation heap) is disabled if the program is run in a debugger without that environment variable. See also this blog post, which discusses how the debug heap can slow down their program by 3-5 times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attached is a quick program written under interview conditions that is designed to flatten
I attached to a program with gdb in OSX and I want to use
I am using attached behaviours to add the ability to sort a ListView by
I imagine this should be a pretty trivial task but using Firefox for Mac,
I’ve only just started using ASP.NET MVC, and I have a somewhat trivial question:
The code attached below produces sporadic test failures (JUnit), works 80% of the time.
(see attached jsfiddle, screenshots; running browsers on Ubuntu 11.10) There seems to be some
I have a taxonomy attached with my content type. While creating node of that
I found this script attached to a modified index page. This looks like some
I have a RotateAnimation attached to an ImageButton which upon click rotates it and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.