Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leondavi
Copy link

@leondavi leondavi commented Jun 12, 2025

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
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
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
Contributor

@yijieg could you help review this one as well?

@yijieg
Copy link
Collaborator

yijieg commented Jun 16, 2025

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]>
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