Heap corruption detected. What does it mean?

This is a discussion on Heap corruption detected. What does it mean? within the C++ Programming forums, part of the General Programming Boards category; What does this error message mean? Thank you for your help Heap corruption detected at 0072FB10 HEAP[algo.exe]: HEAP: Free Heap ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    163

    Heap corruption detected. What does it mean?

    What does this error message mean? Thank you for your help

    Heap corruption detected at 0072FB10
    HEAP[algo.exe]: HEAP: Free Heap block 72fb08 modified at 72fb1c after it was freed
    Windows has triggered a breakpoint in algo.exe.

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

    The output window may have more diagnostic information

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I see you're trying the shotgun approach to getting help: post the exact same question to as many forums as you can find, then pick the best answer.
    My best code is written with the delete key.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    In case that is a mystery to you, ypu've broken rule #1
    http://www.catb.org/~esr/faqs/smart-...ons.html#forum
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    163
    oops... sorry guys, never knew there is this etiquette.

    I think I will keep this post as a warning for others in future who commit the same mistake as me.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    Don't worry, plenty of others will make the same mistake, and you're far from being the first.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    To the OP, you're writing to memory after a pointer to it was freed.

    And where else was it posted except here and Daniweb?
    Last edited by medievalelks; 07-22-2008 at 12:07 PM.

  7. #7
    Registered User
    Join Date
    Dec 2004
    Posts
    163
    only here and Daniweb. Just curious, is there a competition between here and Daniweb? Like yahoo and google search engine?

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    >> Just curious, is there a competition between here and Daniweb? Like yahoo and google search engine?

    No, kind of the opposite. A lot of the same people help answer questions on both sites and don't like seeing the same question posted multiple places. The same goes for any other C++ programming forum. Chances are that there will be some of the same people at every place you go.

  9. #9
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Well, the quoted "netiquette" mentions posting to "every site you can find". I hardly think that two sites is abuse of this rule, and furthermore, there really are no "rules" on the internet. I mean, it's some guy's opinion.

    If it's really that offensive, just ignore it.

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    We've had this exact same conversation recently, with the same people. I basically agreed with you then, obviously others don't. I'm not sure it's necessary to do again, other than perhaps to tell the OP that there is more than one opinion about it. Of course, in situations like this, as long as behavior offends some people it doesn't really matter if it doesn't offend you.

  11. #11
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Well teh real ball buster is, the error he recieved pretty much explained the problem in itself. I'm not sure I can explain it better than you used a pointer after it was freed, which is obvioulsy illegal behavior.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  12. #12
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Daved View Post
    Of course, in situations like this, as long as behavior offends some people it doesn't really matter if it doesn't offend you.
    It does if they hijack threads to play Net Cop when it really isn't necessary.

  13. #13
    Registered User
    Join Date
    Dec 2004
    Posts
    163
    Quote Originally Posted by abachler View Post
    Well teh real ball buster is, the error he recieved pretty much explained the problem in itself. I'm not sure I can explain it better than you used a pointer after it was freed, which is obvioulsy illegal behavior.
    I solved my problem, I declared an array of pointers but I didn't initialize them to NULL. Then when I allocate memory to other arrays, somehow the uninitialized array of pointers is actually pointing to my new allocated arrays, resulting in the memory error.

    I think microsoft visual studio is very sensitive to this kind of things when in debugging mode. When my program is in exe mode, I don't encounter this kind of error message

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    >> When my program is in exe mode, I don't encounter this kind of error message
    That's a bad thing, and it's good that the debug mode catches errors like this (which it only does some of the time). You want your application to crash in those instances so you know something is wrong, rather than providing quietly incorrect data to the user.

  15. #15
    Registered User
    Join Date
    Dec 2004
    Posts
    163
    you are right, but i was thinking of saving time by not setting the pointers to NULL as I will definitely allocate memory to the pointers later. But nevermind, its better to be safe.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. This may be due to a corruption of the heap
    By krishnampkkm in forum C++ Programming
    Replies: 4
    Last Post: 06-26-2009, 03:19 AM
  2. Replies: 7
    Last Post: 11-26-2007, 12:11 PM
  3. Heap corruption using zlib inflate
    By The Wazaa in forum C++ Programming
    Replies: 0
    Last Post: 03-29-2007, 12:43 PM
  4. Heap corruption errors
    By VirtualAce in forum C++ Programming
    Replies: 0
    Last Post: 07-15-2006, 04:46 PM
  5. heap question
    By mackol in forum C Programming
    Replies: 1
    Last Post: 11-30-2002, 04:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21