SIGSEGV - Runtime Error due to malloc - Please reply

I was writing code for a program in which i used malloc. When i ran that code it showed Run Time Error (SIGSGV). I was trying to allocate around 30,000 int dynamically (int *scratch = (int *)malloc(10000 * sizeof(int));). Adding to this i am also using merge sort which runs recursively and 10,000 elements will be sorted. Is it due to the malloc which is trying to allocate dynamic memory or the recursion?

Another problem related to this. I was created a double link list and was using malloc for creating new nodes. The problem states that there could be 150000 elements ( ranging from 1-200). So to store that i used short int (2 bytes). Now this much of dynamic allocation of memory could be a problem?? I am still getting SIGSEGV error for this program too. Could this much of usage of memory during run time create this error??
Thanks in advance.

it should be

int* scratch=(int*)malloc(sizeof(int)*10000);

My opinion is that it’s not because of malloc, probably it’s something like “index out of bounds” - you have array of 10000 elements and use index like 10100 or something similar…

it doesnt matter , my code running correctly. i think both ways correct.