Skip to content

Fixes memory leak in SDF calculation - warp doesn't free memory - #2680

Merged
kellyguo11 merged 3 commits into
isaac-sim:mainfrom
leondavi:main
Jun 27, 2025
Merged

kellyguo11 merged 3 commits into
isaac-sim:mainfrom
leondavi:main

Conversation

@leondavi

@leondavi leondavi commented Jun 12, 2025 •

Copy link
Copy Markdown
Contributor

Description

Thanks to Matteo Grimaldi, Saleh Nabi and Wonju Lee for identifying the source of this memory leak.

Add garbage collector calls since warp doesn't handle well the free memory.

Fixes #2679

Type of change

  • Bug fix

Screenshots

Before this change - the experiment hasn't been completed on 64GB RAM machines.
After this change it requires less than 12GB RAM.

Screenshot 2025-06-12 at 18 31 38

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@leondavi
leondavi requested a review from kellyguo11 as a code owner June 12, 2025 09:42

sdf_reward = -torch.log(sdf_reward)

gp.collect() # Force garbage collection to free memory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be gc.collect()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes - I will fix this typo
Thanks!

@kellyguo11

Copy link
Copy Markdown
Contributor

@yijieg could you help review this one as well?

@yijieg

yijieg commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Hi @kellyguo11 , this change looks good to me. It helps save memory but does not affect the reward we calculated, so it will not affect the learning performance.

Fix typo

Signed-off-by: David <[email protected]>
@kellyguo11 kellyguo11 changed the title Fix memory leak in SDF calculation - warp doesn't free memory Fixes memory leak in SDF calculation - warp doesn't free memory Jun 25, 2025
@kellyguo11

Copy link
Copy Markdown
Contributor

@leondavi could you please run the formatter with ./isaaclab.sh -f?

@kellyguo11
kellyguo11 merged commit fa8612f into isaac-sim:main Jun 27, 2025
harry-wf-cheung pushed a commit to harry-wf-cheung/IsaacLab-Harry that referenced this pull request Jul 30, 2025
…c-sim#2680)

# Description

Thanks to Matteo Grimaldi, Saleh Nabi and Wonju Lee for identifying the
source of this memory leak.

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Add garbage collector calls since warp doesn't handle well the free
memory.

Fixes isaac-sim#2679 

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix

## Screenshots

Before this change - the experiment hasn't been completed on 64GB RAM
machines.
After  this change it requires less than 12GB RAM.
<!--
Example:

| Before | After |
| ------ | ----- |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->
![Screenshot 2025-06-12 at 18 31
38](https://github.com/user-attachments/assets/695de828-2f9d-4714-aae3-5d9831ae6e77)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------

Signed-off-by: David <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
LJones-alt pushed a commit to LJones-alt/IsaacLab-Laura that referenced this pull request Jul 1, 2026
…c-sim#2680)

# Description

Thanks to Matteo Grimaldi, Saleh Nabi and Wonju Lee for identifying the
source of this memory leak.

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Add garbage collector calls since warp doesn't handle well the free
memory.

Fixes isaac-sim#2679 

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix

## Screenshots

Before this change - the experiment hasn't been completed on 64GB RAM
machines.
After  this change it requires less than 12GB RAM.
<!--
Example:

| Before | After |
| ------ | ----- |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->
![Screenshot 2025-06-12 at 18 31
38](https://github.com/user-attachments/assets/695de828-2f9d-4714-aae3-5d9831ae6e77)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------

Signed-off-by: David <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
csj-275 pushed a commit to csj-275/IsaacLab that referenced this pull request Jul 8, 2026
…c-sim#2680)

# Description

Thanks to Matteo Grimaldi, Saleh Nabi and Wonju Lee for identifying the
source of this memory leak.

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Add garbage collector calls since warp doesn't handle well the free
memory.

Fixes isaac-sim#2679 

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix

## Screenshots

Before this change - the experiment hasn't been completed on 64GB RAM
machines.
After  this change it requires less than 12GB RAM.
<!--
Example:

| Before | After |
| ------ | ----- |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->
![Screenshot 2025-06-12 at 18 31
38](https://github.com/user-attachments/assets/695de828-2f9d-4714-aae3-5d9831ae6e77)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------

Signed-off-by: David <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
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.

[Bug Report] Automate assembly Environment in SDF - Warp doesn't free memory of mesh points when scope is ended

4 participants