gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.18k stars 479 forks source link

Gazebo 7 (v. 7.12.0) Memory Leak After Deleting Objects #2461

Open osrf-migration opened 6 years ago

osrf-migration commented 6 years ago

Original report (archived issue) by Pourya Hoseini (Bitbucket: PouryaHoseini).


It seems there is a memory leak with Gazebo 7 (mine 7.12.0) after deleting objects. When an object is added, the memory usage goes up for gzclient and gzserver, but it does not come down after deleting the objects. It happens both through manual insertion and deletion and those via roslaunch (ROS Kinetic) too.

It can be very critical issue. For example, in my application, I insert and then delete objects repeatedly, so after a while the system goes out of memory.

My system is an Ubuntu 16.04, if it is helpful.

osrf-migration commented 6 years ago

Original comment by Pourya Hoseini (Bitbucket: PouryaHoseini).


osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


There's an old related question here with some pointers:

http://answers.gazebosim.org/question/11998/why-does-performance-decrease-when-removing-inserting-models/

I thought there was already an issue for this but I couldn't find one.

osrf-migration commented 6 years ago

Original comment by Pourya Hoseini (Bitbucket: PouryaHoseini).


Yes. That one can be a related issue or not. This problem is for Gazebo 7, but that one was originally for Gazebo 6.

Anyways, for this issue the problem is clear. It looks like objects are not removed from the memory after deletion.

osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Cleaning a model means properly cleaning up its nested models, links, joints, lights, collisions, visuals, sensors, plugins...

  1. Does your model have any of the things mentioned above? Does removing each of them from the model impact the memory leak?
  2. Are both gzserver and gzclient impacted? Have you tried the server headless?

A while back there was some effort to properly clean up pointers when a world is deleted, see pull request #2263 for example. It would be worth it writing similar tests for all kinds of models.

osrf-migration commented 6 years ago

Original comment by Pourya Hoseini (Bitbucket: PouryaHoseini).


1- All my models are no more than a link, which those links have collisions and visuals. I also tested with common objects like "coke_can" or "hammer". The problem exists with all of them. For separate removal, actually, I don't know how I can remove just a part of a model during the simulation.

2- gzserver and gzclient are both affected. I tried with a headless server. The gzserver experiences the issue in that condition too.

osrf-migration commented 6 years ago

Original comment by erwan_r1d1 (Bitbucket: erwan_r1d1).


Hi, as any progress been made on this issue ? We experience the same problem and we are in a similar situation as OP: we add and delete objects repeatedly but memory keeps increasing.

osrf-migration commented 6 years ago

Original comment by Weihao Yuan (Bitbucket: skywhao).


Stuck in the same problem. Gazebo performance decreases and then crashes, and the memory keeps increasing. Any solution?

mkhansenbot commented 4 years ago

Do you know the root cause and can it be fixed?