Quantcast
Channel: Heap corruption - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Heap corruption

$
0
0

Why is it a problem if we have a huge piece of code between new and delete of a char array.

Example

void this_is_bad() /* You wouldn't believe how often this kind of code can be found */{  char *p = new char[5];    /* spend some cycles in the memory manager */  /* do some stuff with p */  delete[] p;      /* spend some more cycles, and create an opportunity for a leak */}

Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles



Latest Images