Hello,
The dynamic memory allocation does not use the stack, but uses a separate heap. The default size of the heap is 2000 bytes, which exceeds your total RAM resources for the device you are using. It is possible to reduce the heap size, but this will require you to rebuild some library files.
https://community.freescale.com/message/19417#19417
I suggest that you try to avoid using malloc(). if the memory allocation can be handled as one or more local variable(s) within a function, increase the stack size by an appropriate amount.
However, if the variables require to be accessible by more than one function, they will need to be defined as static (or global), outside of any function. If the memory block has different types of usage at different times, this might be handled by defining a union.
Regards,
Mac