There appears to be a memory leak in Isaac Sim when using the methods attach and detach for both writers and annotators. I’ve tested on both 4.0.0 and 2023.1.1.
Here is some sample code to prove the issue.
from isaacsim import SimulationApp
# from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"headless": True}) # Option: "renderer": "PathTracing"
import omni.replicator.core as rep
import psutil
def sample_memory():
return psutil.Process().memory_info().rss / 1024 / 1024 # in MB
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
output_dir="/isaac-sim/output",
rgb=True,
distance_to_image_plane=True,
normals=True,
frame_padding=8,
)
rep_camera = rep.create.camera()
render_product = rep.create.render_product(
rep_camera,
resolution=(640,
480),
name="test_render_product"
)
for _ in range(1000):
print(f"sample_memory = {sample_memory()}")
writer.attach(render_product)
writer.detach()
I’ve noticed similar behavior with annotators. I assumed this was a valid way of using render products because of this example.
See the function _run_pallet_scenario
.