tags:

views:

109

answers:

1

Hi,

Until now I thought that a Main Panic 42 occurs only when I try to access data that is outside of boundaries of an array for instance. Thanks to some nice feedback of you guys I was able to solve me other problem. However, what happens now is that I get this Panic when trying to allocate a char array as follows

unsigned char *buf = new unsigned char[5000];

Anyone an idea what could have happenend? It works fine once, but the second time the program comes accross this line it crashes. Is there any good strategy to tackle this error?

Thanks once again!

A: 

Heap corruption is a likely reason for USER 42 panics. For instance, writing beyond the boundaries of other allocated cells or using a stale pointer to already freed memory.

First start by looking at the allocs/frees/memory writes occuring prior to that panic point. Usually you don't have to go very far back to find the corruption.

laalto