Delete [] PTR raises the core error of Singnal 6 abort, the trace process found writing PTR large amounts of data, throwing out memory out of bounds, destroying the tail data protection of the new array, leading to the time of the delete core.
The problem analysis process wrote a test code, found that some other editor or the nature of the operating system, the new application array is always allocated 2 of the N-square space, such as char* ptr = new char[10] Actually allocated 16 bytes of space, char* ptr2 = new char[ 15] Also allocates 16 bytes of space, while char* PTR3 = new Char[16] Allocates 32 bytes of space, thus speculating that a special character with a byte at the end of the new array is used for protection.
Although the core is found, the memory allocations for the system new and delete are not understood: char* ptr = new Char[10] writes 17 characters to Ptr,delete [] PTR does not core; writes 29 characters to PTR, Delete [] PTR raises the core of signal6 abort, and the head and tail data protection for the memory request is still unclear.
Core analysis caused by delete array