Skip to content

Conversation

@OAHC2022
Copy link

@OAHC2022 OAHC2022 commented Jul 22, 2025

Fixes #108

Copy link
Collaborator

@tesslerc tesslerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took a bit to reach.
This looks good overall, but I think it needs a better way to access which objects are assigned to which env.

See below:

            for env_id in range(self.num_envs):
                env_ptr = self._gym.create_env(self._sim, lower, upper, num_per_row)
                
                # Aggregate bodies helps improve memory when using objects in IsaacGym
                # calculate the max aggregate body and shape counts for the humanoid robot
                max_agg_bodies = self._gym.get_asset_rigid_body_count(humanoid_asset)
                max_agg_shapes = self._gym.get_asset_rigid_shape_count(humanoid_asset)

                # Fetch the scene associated with this env
                scene = self.scene_lib.scenes[env_id]
                for obj in scene.objects:
                    # Iterate over all objects in the scene, obtain the IsaacGym asset and extract info
                    object_asset = self._object_assets[obj.first_instance_id]
                    max_agg_bodies += self._gym.get_asset_rigid_body_count(object_asset)
                    max_agg_shapes += self._gym.get_asset_rigid_shape_count(object_asset)

                # aggregate body and shapes to save memory
                self._gym.begin_aggregate(env_ptr, max_agg_bodies, max_agg_shapes, True)
                self._build_env(env_id, env_ptr, humanoid_asset, visualization_markers)
                self._gym.end_aggregate(env_ptr)
                self._envs.append(env_ptr)
                progress.update(task, advance=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory Leak with Scenelib?

2 participants