ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
if(OutChannel.size() < buffer_size) //here OutChannel is a list for structure pointers: packets.
pkt = buffer_queue.front();
//Here depending upon the type of the packetype, and the channel availability, they are sent to destination nodes. The pkt_Received method is called upon by the destination node when it receives the packets, here the whole linked list.
//Packet Dropped: Output Channel Occupied,Wait for the Next Round
:The Problem is I get "terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc " error when I try to create huge numbers of packets in my program, I am using Message-Size from the trace file to determine the numbers of packets to be created for each object node, I am creating a mesh of 16 nodes here, which communicate to each other.
With small number of messages the program runs fine. I am not sure if
"delete previous" is the right way to free the memory..
Yes, in the code all these are structure pointers
packet *head, *body, *tail;
I am sorry for the incomplete code.
I was trying to cut my code to make it readable, so I missed the preceding if statement.