omnet++ std::bad_alloc

865 views
Skip to first unread message

ql zhang

unread,
Feb 1, 2012, 4:31:54 AM2/1/12
to omnetpp
I set up a little project on the inet framework, there are 10000
clients, these clients connect to a router and the router connects to
a server through another router. The protocol is TCP, clients use
TCPBasicClientApp and server uses TCPGenericSrvApp. Then I ran the
project and got "std::bad_alloc" when

** Event #26208768 T=10.901906627599 Elapsed: 109.655s (1m 49s)
Speed: ev/sec=321664 simsec/sec=0.0704114 ev/
simsec=4.56835e+06
Messages: created: 7203759 present: 121136 in FES: 19993

The error is

<!> Error in module (TCP) nClients.cli[139].tcp (id=42699) at event
#26644721, t=11.043783567931: std::bad_alloc: std::bad_alloc.

My os is 32bit 4G memory ubuntu, and the size of core dump is 3G. I
supposed the memory is not large enough, but I do not think this
project is too large. It is reasonable to simulate this network. So I
don't know what the true reason is that causes this error. From
another point, if it is true that not enough memory causes this
problem, network as large as this scale can not be simulated on 32bits
OS, because one process can only use as large as 4G memory. So what
the error is.

waiting for your help!

ql zhang

unread,
Feb 2, 2012, 9:58:15 PM2/2/12
to omnetpp
i found the reason, i did not add "**.vector-recording = false" into
omnetpp.ini

Rudolf Hornig

unread,
Feb 3, 2012, 5:02:40 AM2/3/12
to omn...@googlegroups.com
Yeah, you are right, vector writing requires some buffers and because each host would write a vector that will consume  a lot of memory. You should disable the unnecessary vectors if you want to simulate large network.

Rudolf

--
Sent from the OMNeT++ mailing list. To configure your membership,
visit http://groups.google.com/group/omnetpp

parin

unread,
Jul 19, 2012, 3:25:06 PM7/19/12
to omn...@googlegroups.com
hello, I add  "**.vector-recording = false" into omnetpp.ini but I again have Error "std:: bad_alloc". can you help me?

Matt Miller

unread,
Jul 19, 2012, 3:34:46 PM7/19/12
to omn...@googlegroups.com
Messages:  created: 7203759   present: 121136   in FES: 19993  

The present col is the number of messages still in the system. FES is the number of messages scheduled in the future. If the number of messages present is growing but FES is constant or shrinking you probably are not deleting messages once you are done with them.

Try the sim with 1 client so that it runs to completion. If you have print-undisposed=true in your omnetpp.ini or if you do not have a print-undisposed line you will get a list of undisposed object at the end of the sim run with what module they originated in. That will help you narrow down which messages are not being cleaned up.

Matt


--

Krishna Oza

unread,
Dec 18, 2012, 5:22:39 AM12/18/12
to omn...@googlegroups.com
I think it has nothing to do with vector recording. I have no log or any  kind of statics collection and still getting the error std::alloc_bad . I am using adhoc network with oslr protocol. Every time i get error at different nodes. and all together i have only some 250-300 nodes.

Sabari Nathan

unread,
Feb 9, 2017, 6:24:56 AM2/9/17
to OMNeT++ Users

Same OLSR protocol with 100 nodes, I get the same error. Did you figure out what to do?

Wian Virgi

unread,
Feb 9, 2017, 6:35:29 AM2/9/17
to omn...@googlegroups.com
What error you get?
--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Sabari Nathan

unread,
Feb 9, 2017, 6:40:05 AM2/9/17
to OMNeT++ Users
when I'm running simulations based on adhoc networks I get the following error :: error in OLSR module std::bad_alloc. for some simulations the system works fine.
Processor: Intel Xeon
RAM: 16GB
OS: 32 bit - PAE enabled
OMNeT -5.0
Inet 3.2.4

Wian Virgi

unread,
Feb 9, 2017, 6:43:07 AM2/9/17
to omn...@googlegroups.com
I'm used olsr too but just 20 node with attacker and time 600s.. Sometime get error because need more space memory... 

Sabari Nathan

unread,
Feb 9, 2017, 6:44:11 AM2/9/17
to omn...@googlegroups.com
Mone is 100 node network. Around 10 or 11 second the error pops up. 

To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.

Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/8XfnFpI0CgA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+unsubscribe@googlegroups.com.

Danh Le Dinh

unread,
Jun 12, 2017, 9:19:25 PM6/12/17
to OMNeT++ Users
Hi Rudolf,
I got the same error in module (TCP).. t=: std::bad_alloc: std::bad_alloc, even tho
ugh I set **.vector-recording = false in omnetpp.ini. I am running simulation with a medium size network, but I need to test with high traffic load so I thought it is possible that the memory run low sometimes, but do you think of any solution, for instance to change code in INET modules (here TCP module)
  that would solve the problem? Many thanks.
Danh
PS: sorry for the bold text, but I could not make it unbold!

Saima Saleem

unread,
Aug 28, 2017, 7:47:45 AM8/28/17
to OMNeT++ Users
i also have the same problem Error in module (Ieee80211MgmtAP) BOM.ap[5].wlan[0].mgmt (id=1758) at event #26011459, t=50.694840106288: std::bad_alloc: std::bad_alloc.
  can anyone figure out this????
You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/8XfnFpI0CgA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.

Le Dinh Danh

unread,
Aug 28, 2017, 9:11:05 AM8/28/17
to OMNeT++ Users
Hi Saima Saleem,

The error "std::bad_alloc: std::bad_alloc." could occur anywhere when the simulation reaches to a point that it cannot allocate any more memory. So if you see it happens with specific module, that doesn't mean there is error caused by the that module. At least, I see this point in my situation. But it is recommended that we should make sure our model is error-free, right? 
Errors related to memory can be debugged using GDB or Valgrind, (I prefer Valgrind). So first you should profile your model using Profile As.. option in Omnet IDE.

If you make sure that your models are error-free, but it still crashes sometimes with "std::bad_alloc: std::bad_alloc", it is time to think about the OS used. I my case, before I used Ubuntu 12.4 32-bit, and it allows the RAM up to ~10% and the simulation crashes after that. Then I tried with Omnet 5.x, use Ubuntu 16.4 64-bit, now I can run up to ~100% RAM. So my advice is if you make sure the errors are not come from your models, just try 64-bit OS. But note that, there may be different between Linux and Windows. I also tried to run my models with Windows 10 64-bit, it it also crashes quickly when big RAM is required.

Hope this helps!
Danh

To unsubscribe from this group and all its topics, send an email to omnetpp+unsubscribe@googlegroups.com.

Gideon

unread,
Jan 28, 2018, 6:21:11 PM1/28/18
to OMNeT++ Users
Hi Rudolf,
Thanks for your reply.
I have a lot of vectors in my 500-node simulation model but I'm using a 4.0 GB RAM, 2.16 GHz processor and I have 121/500 GB hard disk space left.
My question are: how does omnet++ allocate buffer memory? How can I upgrade my machine to be able to run the model without error?
Thanks in adv,
Dede
Reply all
Reply to author
Forward
0 new messages