SIGSEGV in new/malloc

Eljay Love-Jensen eljay@adobe.com
Wed Sep 15 12:13:00 GMT 2004


Hi Karthik,

Sorry, I could not get this to crash...
int main()
{
     typedef unsigned char BYTE;
     int nNewSize = 1;

     void** m_pData = (void**) new BYTE[nNewSize * sizeof(BYTE*)];
}

What compiler flags are you using?

What OS are you using?

Does your program do anything more than the above, or is this the smallest 
program that reproduces the problem for you?

You could do this, by the way...
void** m_pData = new void*;
...cuts out some array voodoo magic sizing monkey business.  But that 
shouldn't have any impact on your problem.  Just a coding style suggestion.

--Eljay



More information about the Gcc-help mailing list