C++内存溢出是大型网络仿真绕不过的阻碍!
解决方案: 遇到这种问题并不可怕,首先看看当前仿真中的数据包数量是不是巨大,是则去找找每个数据包在哪个模块逗留,改对应的代码即可.如果不是这个问题,那就构造一个简单的网络, 用inet中的模块替换你自己写的模块,以此找出问题模块,然后改吧.
故事简介:
今天发现交换机在为查询流表时新建了match结构体却没有删除,剪切代码如下,
void Open_Flow_Processing::processQueuedMsg(cMessage *data_msg) {... oxm_basic_match *match = new oxm_basic_match();...
用这个代码跑一个大数据量的网络仿真, 没过几秒就出现如下bug. 显然每处理一个数据包就浪费掉oxm_basic_match大小的内存, 因而没处理多少数据包就挂掉了.
Simulation terminated with exit code: 3 Working directory: D:/omnetpp-4.2.2/samples/openflow/scenarios Command line: ../openflow.exe -r 0 -u Cmdenv -c EXR-noweight -n ..;../../inet/examples;../../inet/src -l ../../inet/src/inet --record-eventlog=false --debug-on-errors=false FT42.ini
或者
unable to alloc 70 bytes This application has requested the Runtime to terminate it in an unusual way. Please contact the application‘s support team for more information. Font {Segoe UI} 9 still in cache. Simulation terminated with exit code: 3 Working directory: D:/omnetpp-4.2.2/samples/openflow/scenarios Command line: ../openflow.exe -r 0 -u Tkenv -c EXR-noweight -n ..;../../inet/examples;../../inet/src -l ../../inet/src/inet --record-eventlog=false --debug-on-errors=false FT42.ini
时间: 2024-10-12 16:19:02