Greetings,
I'm having an issue at a lower level of ns2, version 2.31. In my
application, I create a PacketData object, and send a new packet with
an UDP agent, like this:
PacketData vodinfo(10);
agent_->sendmsg(size_, &vodinfo);
I don't even fill the data in the object yet. At some point in the
simulation, Packet::copy() is called, and the simulator breaks with a
'Could not access memory (EXC_BAD_ACCESS)', which occurs in line 643
in packet.h:
inline Packet* Packet::copy() const
{
Packet* p = alloc();
memcpy(p->bits(), bits_, hdrlen_);
if (data_)
p->data_ = data_->copy(); <- fails here
p->txinfo_.init(&txinfo_);
return (p);
}
It would seem it cannot access 'p->data', which is a private AppData*
variable. Since this is so low-level in ns, I cannot imagine what the
cause of the problem might be.
Can someone provide some clues as to why this is happening?
With regards,
Andre Reis