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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:32:45+00:00 2026-05-17T02:32:45+00:00

Sometimes in execution I get this error message in VS2010 when trying to free

  • 0

Sometimes in execution I get this error message in VS2010 when trying to free memory:

Windows has triggered a breakpoint in [APPNAME].exe.

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

This may also be due to the user pressing F12 while [APPNAME].exe has focus.

The output window may have more diagnostic information.

Wich means something is wrong with heap or pointer.

My issue is that this error crashes my app when it is built as a release.

Also this is just a module of bigger application and when this crashes everithing goes down.

I would like to be able to handle this error.

From msdn on “free”:

If an error occurs in freeing the memory, errno is set with information from the operating system on the nature of the failure. For more information, see errno, _doserrno, _sys_errlist, and _sys_nerr.

There is a errno_t _get_errno( int * pValue ); function that returns error code.

If I press continue on the error msg shown above this function returns error code.
Using this code I can detect error, create call stack and exit my function softly.

Is there any compiler switch or something to prevent aplication from crashing when free fails and allow me to exit it my way??

  • 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-17T02:32:46+00:00Added an answer on May 17, 2026 at 2:32 am

    If the heap is corrupted, all bets are off. Memory allocations may fail (unless they’re on the stack), they might return pointers to wacky areas, and even existing stuff on the heap could be mangled beyond recognition. In such cases, you’re actually better off crashing, as any action you take (even trying to gracefully exit) could just make things much worse.

    Find the code that’s mangling stuff on the heap, and fix or remove it.

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

Sidebar

Related Questions

I sometimes get the following exception: COM object that has been separated from its
When I try to do this I receive the following error message: Add member
Sometimes I get the following from SQL Server 2005 when executing a stored procedure:
Sometimes in an application, one might compare the Message text of an exception. For
Sometimes when using Visual Studio it displays a prompt with a filename: This file
Sometimes I get exception in my production environment: Process information Process ID: 3832 Process
This code causes the following exception, sometimes : Attempted to read or write protected
Sometimes when using ipython you might hit an exception in a function which has
In my windows forms app clients sometimes report a strange exception: System.InvalidOperationException: Value Dispose()
I have this error in xcode: Terminating app due to uncaught exception 'NSRangeException', reason:

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.