Thread: Heap corruption detected

  1. #1
    Registered User
    Join Date
    May 2010

    Heap corruption detected

    I don't know what I am doing, but I would like someone to help me on this.

    I am trying to build a default constructor by using the initializer list, and I am getting this error.

    HEAP CORRUPTION DETECTED: after Normal block(#126) at 0x003C5060. CRT detected that the application wrote to memory after end of heap buffer.

    I believe the error could be on these following modules.

    class list
    ... ...
    	struct node
    		// constructor
    		node(const winery& winery);
    		winery item;
    		node * nextByName;
    		node * nextByRating;
    	node * headByName;
    	node * headByRating;
    list::list() :
    	delete headByName;
    	headByName = NULL;
    	delete headByRating;
    	headByRating = NULL;
    	delete myHead;
    	myHead = NULL;
    	delete myTraverser;
    	myTraverser = NULL;
    But I'd rather send you guys the entire code so that I can avoid any confusions, and for you to test it and know what I'm talking about. - File Shared from - Free Online File Storage

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Look at the number in () - #126

    Now read this
    How to use _crtBreakAlloc to debug a memory allocation

    This will stop in the debugger just as you allocate that block. You can then follow it through to see where you're overwriting the end of it.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Heap Corruption Detected -- Malloc issues
    By gp364481 in forum C Programming
    Replies: 4
    Last Post: 04-09-2010, 11:47 AM
  2. Heap corruption Detected Error
    By mrsirpoopsalot in forum C++ Programming
    Replies: 2
    Last Post: 10-26-2009, 03:59 PM
  3. Heap corruption detected. What does it mean?
    By franziss in forum C++ Programming
    Replies: 17
    Last Post: 07-23-2008, 02:50 AM
  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, 05:03 AM