【发布时间】:2012-08-05 05:41:51
【问题描述】:
我的 Malloc 在我的项目中失败了。 Malloc 通过其中一个函数运行多次,但由于内存不足而失败。
我正在尝试增加我的 VC++ 中的堆大小,但它给了我上述主题中的错误。
谁能告诉我这有什么问题?
Windows server 2003 R2 企业版 我使用的是 VC++ 98 版本。
我尝试了一些搜索,但无法获得有关如何使用 /HEAP OPTION 的任何结论。 数字应该以 MB 为单位吗?
message_t* Allocate_momory(MsgType_t msgType, UInt16 dataLength)
{
// TO DO: Allocate memenory and return the pointer
message_t* mes_t;
mes_t = (message_t*) malloc(sizeof (message_t));
mes_t->msgType = msgType;
mes_t->dataLength = 0;
mes_t->clientID = 0;
mes_t->usageCount = 0;
mes_t->dataBuf = malloc(sizeof (dataLength));
return mes_t;
}
是的,它有效......但不幸的是它没有解决我的 malloc 问题:( !! 这是一个包含太多文件的庞大项目。 我无法发布代码,但有人可以指导我如何尝试调试 malloc 失败的问题?
【问题讨论】:
-
我正在尝试:- 但我无法摆脱使用选项“/HEAP:11.0”指定的 error.invalid 数字
标签: windows visual-c++ linker heap-memory