Original Post
This is a problem that I've been struggling with for a little bit now and I just can't figure out how to fix it. Basically, I'm creating a large array on the heap of type PIXEL, which is a struct containing 3 BYTE variables. The declaration of the array is like so:
PIXEL* pixel=new PIXEL[len];Now the problem arises when I edit the information, such as calling memset((void*)pixel,0,len*sizeof(PIXEL)). Now, a call to _CrtCheckMemory() will return false, and if I try to delete [] pixel, the program crashes with the HEAP CORRUPTION DETECTED dialog box. Now, I think the reason for the problem is that I am trying to allocate too much memory, and that is causing the failure. When len is 7232, everything works fine, but when len is 331200, I get all the problems I just described (those specific numbers are the amount of bytes in two different files- the pixel array holds part of the file). I can't allocate less space, so I'm not sure what to do. I'm not even sure what specifically my problem is. Anyone know what's going on? Sorry if I didn't describe my problem well, its been a while since I last posted on a forum. Edit-- Known typos fixed, sorry about the confusion... [Edited by - CrazyCamel on July 14, 2006 12:27:42 AM]