In my win32 console application using the Microsoft 'C' Compiler, I am using malloc to allocate memory in various places. It is working very fine, but sometimes, malloc failed to allocate memory of given size. The allocated Pointer variable has no memory and I am getting the "Unhandled Exception". The control flow stops at the _heap.c(system file).
Could you please tell me in what are all the cases Malloc will get fail?
How could we rectify this issue as a permanent?
Also in some cases, while I am deallocating the dynamically allocated variable using the free(), getting assertion failed Error. Initially the Pointer variable is declared as NULL.
Could you please tell me why it is happening and how to resolve this issue.
Earliest replies are appreciated.
Thanks in advance.