Problem with Gazebo std::bad_alloc

asked 2018-03-20 07:20:26 -0600

Aestor gravatar image

I installed Gazebo a couple weeks ago along with ros-kinetics on ubuntu 16.04. Until yesterday Gazebo would launch with no problems, I have hardly used it and now when I try to launch it as an application it appears for a split second and then disappears, while if I try to launch it with the terminal it says

"terminate called after throwing an instance of 'std::bad_alloc'

what(): std::bad_alloc

I just installed ubuntu and have never used this kind of stuff so I have no idea of what the problem could be, i tried searching for this problem but most people are having this problem as a C++ problem. Yesterday during class we wrote some C++ code, but I didn't link it to Gazebo. I don't know what to do and I'm afraid I might to some mistake while trying to fix it.

Thank you in advance

edit retag flag offensive close merge delete


Instead of just using the gazebo command, try doing the following: 1) open a terminal, and run the command "roscore" 2) open another terminal and now run "rosrun gazebo_ros gazebo" Does doing this give you different results?

Raskkii gravatar imageRaskkii ( 2018-03-20 08:31:18 -0600 )edit

I tried it and it says "[rospack] Error: package 'gazebo_ros' not found" This morning I tried to uninstall and reinstall gazebo with sudo apt-get remove gazebo7 and later sudo apt-get install gazebo7, could that be the problem I am facing right now?

Aestor gravatar imageAestor ( 2018-03-20 08:44:53 -0600 )edit

Try running: "sudo apt-get install ros-kinetic-gazebo-ros-pkgs" and after that try the instructions from my first comment again.

Raskkii gravatar imageRaskkii ( 2018-03-20 09:10:33 -0600 )edit

I tried that and now it gives me this: [ INFO] [1521635182.476361394]: Finished loading Gazebo ROS API Plugin. [ INFO] [1521635182.476970063]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting... [ INFO] [1521635182.965983542]: waitForService: Service [/gazebo/set_physics_properties] is now available. [ INFO] [1521635182.991163134]: Physics dynamic reconfigure ready. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

Aestor gravatar imageAestor ( 2018-03-21 07:24:31 -0600 )edit

Aborted (core dumped) /opt/ros/kinetic/lib/gazebo_ros/gazebo: 46: kill: invalid signal number or name: SIGINT

Aestor gravatar imageAestor ( 2018-03-21 07:25:02 -0600 )edit

So it goes back to the std::bad_alloc error. I've encountered it a few times but it's usually resolved when i simply run Gazebo again. From quickly googling, std::bad_alloc is caused when you run out of memory. Unfortunately I'm not sure if I know how to help you resolve this problem.

Raskkii gravatar imageRaskkii ( 2018-03-21 11:15:29 -0600 )edit

Having the same problem here with std::bad_alloc and yes it is due to a memory issue. Still did not find how to solve this. Does anyone have some recommendations here ? thx

jkoubi gravatar imagejkoubi ( 2022-02-02 16:05:05 -0600 )edit