SIGSEGV in new/malloc

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

 



Hi,

	I am using g++ version 2.95.2. The following code crashes
intermittently 

	typedef unsigned char	BYTE;
	int nNewSize = 1;

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

Back trace on gdb does not give me the lib where it crashes



Then, I tried this,

		void** m_pData = ( void ** )malloc( nNewSize * sizeof(
void * ) );

	and even 

		void** m_pData = ( void ** )malloc( 4 );

But it always gives a SIGSEGV. bt from gdb in this case gives

#0 in _smalloc() from /usr/lib/libc.so.1
#1 in malloc() from /usr/lib/libc.so.1


What am I doing wrong? Have I run out of virtual memory for malloc to
crash?

TIA,

Kartik


[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