Non-deterministic memory leak when using multiple worlds

Hi, I just wanted to check if there is something fundamentally wrong with my setup since I am facing non-deterministic memory leaks.

  1. I load a robot from a URDF file.
  2. I create N worlds with a single cloned robot in each.
  3. I attach a bullet collision detector to each.
  4. I create a collection of threads with an attached function which is an infinite loop over a given world’s step function. Threads go to sleep before each step.
  5. I wake all threads, wait until all are asleep again and collect the data they produced, then repeat.

Is there any obvious no-no in this setting?

I run 16 threads and I observe memory leaks linear in time with slope varied across the runs. This slope can be from flat (not able to observe obvious leak) to very steep (e.g. 64MB/1M simulation frames).

Additionally I rather occasionally see a crash upon setup from the collision detector even though this part is not parallel. Never seen one after setup (tested couple hundred times).