如何解决大素数分解问题??

用C++写了一个分解大素数的代码,结果却出来这样的结果,请问是怎么回事??该如何解决??

输入数据:1801440097841710589
GNU MP: Cannot reallocate memory
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
请按任意键结束.....

http://www.cnblogs.com/kuangbin/archive/2012/08/19/2646396.html

显然从报错来看是内存分配出错了。楼主可以检查下是否分配了过大的内存空间。另外realloc是一种特殊的内存分配函数,它会在原来已分配内存的基础上重新分配内存,容易出错