Random Memory Allocation Failure in

I found a solution to the problem: the reason was that the asterisk was going to be in DEBUG mode and without the OPTIMIZE option, this was done to debug another problem.
After I removed debug mode and turned on optimization, everything worked fine.