Hi, I am trying to simulate the wormwhole routing network topology in c++.
I am using a trace file to read the feed the packets to the network, the trace file contains, source, destination, and the message size. So depending upon the message size, it is divided into packets. In my trace file messages would either be of size 8 , 16, 14000 unit(assuming network has the capacity to transfer 8 units in one cycle), I divide the packet into chunks of size unit 8.The movement in the network would thus be in wormlike fashion as to the property of wormwhole routing.
Whenever the the packet flits start arriving at the destination, which I think I am immediately freeing the memory assigned to that flit.The problem is when the number of messages fed into the network is below 1000, my program works fine, but with the increase in number of message it crashes.
I used valgrind to track the errors, which to my disappointment I am not so good at using it, being a learner, and also gdb.
Here is the error I get using Valgrind:
==22905== Stack overflow in thread 1: can't grow stack to 0xBDE89FE8
==22905==
==22905== Process terminating with default action of signal 11 (SIGSEGV)
==22905== Access not within mapped region at address 0xBDE89FE8
==22905== at 0x4211DA81: _IO_file_xsputn@@GLIBC_2.1 (in /lib/libc-2.5.so)
==22905== Stack overflow in thread 1: can't grow stack to 0xBDE89FE4
==22905==
==22905== Process terminating with default action of signal 11 (SIGSEGV)
==22905== Access not within mapped region at address 0xBDE89FE4
==22905== at 0x40011D0: _vgnU_freeres (vg_preloaded.c:56)
==22905==
==22905== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1)
==22905== malloc/free: in use at exit: 17,945 bytes in 756 blocks.
==22905== malloc/free: 4,062,252 allocs, 4,061,496 frees, 59,790,198 bytes allocated.
==22905== For counts of detected errors, rerun with: -v
==22905== searching for pointers to 756 not-freed blocks.
==22905== checked 6,656,512 bytes.
==22905==
==22905== LEAK SUMMARY:
==22905== definitely lost: 333 bytes in 18 blocks.
==22905== possibly lost: 1,108 bytes in 56 blocks.
==22905== still reachable: 16,504 bytes in 682 blocks.
==22905== suppressed: 0 bytes in 0 blocks.
==22905== Use --leak-check=full to see details of leaked memory.
Segmentation fault
And the error while using gdb:
Program received signal SIGSEGV, Segmentation fault.
0x4211da81 in _IO_new_file_xsputn () from /lib/libc.so.6
(gdb) bt full
#0 0x4211da81 in _IO_new_file_xsputn () from /lib/libc.so.6
No symbol table info available.
#1 0x4211412f in fwrite () from /lib/libc.so.6
No symbol table info available.
#2 0x001f8706 in ?? () from /usr/lib/libstdc++.so.6
No symbol table info available.
#3 0x001f43db in std::num_put<char, std:
streambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long> () from /usr/lib/libstdc++.so.6
No symbol table info available.
#4 0x001f4650 in std::num_put<char, std:
streambuf_iterator<char, std::char_traits<char> > >::do_put () from /usr/lib/libstdc++.so.6
No symbol table info available.
#5 0x001fcf0d in std:
stream:
perator<< () from /usr/lib/libstdc++.so.6
No symbol table info available.
#6 0x0804cff3 in node::update_node (this=0x911c440) at node.cc:158
temp = (._79 *) 0x911f004
flit = (flit_pkt *) 0x911f004
#7 0x0804d5a9 in node::sim_update (this=0x911c440) at node.cc:295
No locals.
Can anyone please help me..forgive me if the question is not clear, I could paste the code here, but I thought it might make the thread even more messy...