C++ error: heap corruption detected:after normal block(#xxx) at 0x xxxxxxxx

C++ error: heap corruption detected:after normal block(#xxx) at 0x xxxxxxxx_第1张图片
This error can occur when deleting or freeing a memory block whose content is longer than its size, that is memory overflow.

example 1:

      
    char*test=(char*)malloc(5);
    strcpy(test,"hello");
    free(test);


example 2:

    char*test=newchar[5];
    strcpy(test,"hello");
    delete test;

你可能感兴趣的:(C++ error: heap corruption detected:after normal block(#xxx) at 0x xxxxxxxx)