I built a c++ code for simulating a communication network (using OMNeT++ discrete event simulator) until there is no errors and the simulation completed, when I tried to increase the number of simulated entities, in any run at some point of time the simulation stops with a message printed in the command prompt says “This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information” and an error message displayed in a dedicated window under the title Application error says ”The exception unknown software exception (0x40000015) occurred in the application at location ....... ” I think the problem, i.e., the simulation stops at and due to this part " ((cMessage *)msg->dup() " in the following code (but that may not be correct):
********
`void ChannelAccess::sendToChannel(AirFrame *msg) {
const ChannelControl::ModuleList& neighbors = cc->getNeighbors(myHostRef);
coreEV << "sendToChannel: sending to gates\n";
// loop through all hosts in range
ChannelControl::ModuleList::const_iterator it;
for (it = neighbors.begin(); it != neighbors.end(); ++it)
{
cModule *mod = *it;
// we need to send to each radioIn[] gate
cGate *radioGate = mod->gate("radioIn");
if (radioGate == NULL)
error("module %s must have a gate called radioIn", mod->fullPath().c_str());
for (int i = 0; i < radioGate->size(); i++)
{
ChannelControl::HostRef h = cc->lookupHost(mod);
if (h == NULL)
error("cannot find module in channel control");
if (h->channel == msg->getChannelNumber())
{
coreEV << "sending message to host listening on the same channel\n";
// account for propagation delay, based on distance in meters
// Over 300m, dt=1us=10 bit times @ 10Mbps
sendDirect((cMessage *)msg->dup(),myHostRef->pos.distance(h->pos) / LIGHT_SPEED, mod, radioGate->id() + i);
}
else
coreEV << "skipping host listening on a different channel\n";
}
}
// register transmission in ChannelControl
cc->addOngoingTransmission(myHostRef, msg);
} `
*********
So, any help will be appreciated as I would like to run the simulation for large number of nodes.
For knowledge I use win xp SP3 and win 7, OMNet++ 3.3, Microsoft visual c++
2005 express edition, one of the computers I ran the simulation on is i7 processor with 8G RAM.
Without knowing anything, I would guess that dup() allocates an object and returns a pointer to it while transferring ownership to the caller. How does the memory usage behave prior to the crash?
The 0x4...15 is an NTSTATUS code. You can look for more information by searching STATUS_FATAL_APP_EXIT.