RE: SIGSEGV in new/malloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eljay,

	Thanks for your response.
	
	Actually there are lots of succesfull calls to new/malloc,
before I run into this error.
	m_pData  is a member of a class, which essentially describes an
array of pointers( of any type, hence void** ). When I initially try to
set the size of the array( to some value that's nNewSize ), I allocate
memory to this array. That's when the crash occurs! 

	Compiler flags are -> -pipe -g -fPIC -Wall -Wno-reorder
	OS -> Solaris 8

	I am cutting out on all the voodoo for now and wrapping around a
std::vector< void* > instead:-).

	Thanks again.

-Kartik
	

-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Eljay Love-Jensen
Sent: Wednesday, September 15, 2004 5:43 PM
To: Karthik J; gcc
Subject: Re: SIGSEGV in new/malloc

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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux