Skip to content

Conversation

@EmbersArc
Copy link
Contributor

Objective

Plugs one of the holes responsible for leaking memory in #21526.

Solution

  • Explicit ordering so that instances are cleaned up and the subsequent SpecializedMaterialViewPipelineCache cleanup step can happen.

Testing

Tested with the first example in the issue while printing the size of the maps in specialize_material_meshes, i.e.

        dbg!(entity_specialization_ticks.len());
        dbg!(view_specialized_material_pipeline_cache.len());

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Oct 13, 2025
@alice-i-cecile alice-i-cecile added D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 13, 2025
@alice-i-cecile alice-i-cecile added this to the 0.17.3 milestone Oct 13, 2025
.before(late_sweep_material_instances),
extract_entities_needs_specialization::<M>
.after(extract_cameras)
.after(early_sweep_material_instances::<M>)
Copy link
Member

Choose a reason for hiding this comment

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

A comment about why this is needed might be helpful for the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a short comment in 9fdbe5b.

To be honest I don't have a complete understanding of the code here and it seems to be very much in flux as it's already being worked on in #21410, which fixes a different but related issue.

@EmbersArc
Copy link
Contributor Author

The fix here looks like it's no longer necessary after #21410. I'll close this PR and update the issue.

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

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants