Open akloss opened 2 years ago
Hi, to solve your memory leak you should use p.saveState() and p.restoreState() instead. There's also an example provided https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/saveRestoreState.py .
Hi,
and sorry to open this up again, but it seems this is still not solved (or again not working). When using the egl renderer, I'm seeing an increase in GPU memory when loading URDF models and then removing them again and resetting the simulation. I'm on pybullet version 3.2.1, CUDA 11.2 and Ubuntu 18.04.
The code I'm using to test is below. Increases are relatively small for untextured objects but become larger if the urdf includes textures.
If
p.resetSimulation()
is commented out, the GPU memory will not increase, but rendering errors occur after a certain number of different URDFs are loaded (seems to be depend on their size): Then the objects are not rendered at all or their texture is not rendered. It doesn't throw any errors in both cases. If I load the URDFs without previously loading other files, they all work well. I couldn't actually reproduce this issue with the code above, but it's easily triggered with my own urdf files (which are much larger than the files in pybullet_data). Also, since it only happens if you load different URDFs, it seems like some caching is happening despite ofenableFileCaching=0
?And finally something maybe unrelated: I noticed that the rendering of the franka arm looks different the second time it gets loaded, independent of whether
p.resetSimulation()
is called or not:If you have any ideas how to fix the memory leak I'd be very grateful!