Ok, this is doing my head in...
Notes: Im Using SDL, Im using Codeblocks to code
Ive narrowed down my crashing problem ( using printf's ) to a malloc call
I had to use printf's because when i ran the program in Codeblocks debugging mode, it did not crash and ran fine, but when i ran it normally, it would crash, giving me this error:
fatal signal segmentation fault (sdl parachute deployed)
Inside my code, I created a malloce function that checks malloc for me ( so i dont have to do it )
( general.h )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
void* malloce ( size_t size )
{
printf ( "start malloce %i\n", size );
void* pointer = malloc ( size ); //<------apparent crash area
printf ( "before check\n" );
if ( pointer == NULL )
{
printf ( "\n\n|-[]= OUT OF MEMORY =[]-|\n\n" );
exit ( 3 );
}
printf ( "end malloce\n" );
return pointer;
}
|
And this is where im calling it from
( employee.h )
employee* emp = malloce ( sizeof ( employee ) );
funny thing is that i called this malloce function about 20 times before it hits this part of the code, it is unknown behavior to me!
All help is much appreciated!
many thanks, superstinger