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 6102281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:35:47+00:00 2026-05-23T13:35:47+00:00

I am getting a strange heap corruption error during the application close where if

  • 0

I am getting a strange heap corruption error during the application close where if a “std::vector” is present in my code, AND I am deleted my “ref_count” variable. If I don’t have an std::vector, there is no crash. If there is a std::vector and I don’t delete the ref_count (causing a memory leak), then there is a heap crash. I am made my test case as small as possible, but unfortunately it is too big for here so it is located at http://codepad.org/USIPjPHJ . Does anyone have any suggestions on what could be the problem?

I will get a crash with the heap exception of this in my output windows.


HEAP[CrashTest.exe]: HEAP: Free Heap block 6d4c30 modified at 6d4c58 after it was freed
Windows has triggered a breakpoint in CrashTest.exe.

This may be due to a corruption of the heap, which indicates a bug in CrashTest.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while CrashTest.exe has focus.

The output window may have more diagnostic information.


My IDE is Visual Studio 2010 SP1 (tried on non SP1 also) but that should not be causing the issue.

  • 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-23T13:35:47+00:00Added an answer on May 23, 2026 at 1:35 pm

    This line:

    strong_ref<int> reg1;
    

    sets *ref_count to 0 (because ptr == NULL), then this line:

    strong_ref<int> copy1(reg1);
    

    increments *ref_count to 1.

    On exit, the destructor is called twice (once for reg1, once for copy1). The first time, *ref_count is decremented to 0 and ref_count is deallocated, leaving a dangling reference for the second time.

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

Sidebar

Related Questions

I'm getting strange error message in Console, but application functions properly. Has anyone else
I'm getting strange error 'int' object has no attribute 'startswith' I haven't used the
I'm getting a strange error when I use F# to read a public readonly
I am getting a strange error using jQuery 1.3.2 and Firefox. I have created
I'm getting a strange NullPointerException, evidently thrown by the following line of code: Iterator<Note>
i am getting a strange bundler error when running bundle pack with bundler 0.9.12
I'm getting a strange syntax error when I run this in VB: SQLString =
I am getting strange results with the following code: iv = (ImageView) findViewById(R.id.iv); iv.setImageResource(R.drawable.spinner_white_76);
I am getting strange error while inserting data into mysql table column. Details: Create
I'm using the Texture2D class from the CrashLanding sample code. I'm getting strange artifacts

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.