Skip to content

Manage Metal objects with smart pointers#3282

Merged
zcbenz merged 1 commit intoml-explore:mainfrom
zcbenz:encoder-refactor-2
Mar 25, 2026
Merged

Manage Metal objects with smart pointers#3282
zcbenz merged 1 commit intoml-explore:mainfrom
zcbenz:encoder-refactor-2

Conversation

@zcbenz
Copy link
Copy Markdown
Collaborator

@zcbenz zcbenz commented Mar 20, 2026

Refs #3148.

For resources that are going to be transferred or kept, store them in NS::SharePtr, for temporary resources use autorelease(). In this way we don't have to manually call release(), which made the code very hard to modify, and it also makes the code exception-safe when we want to handle errors.

Have ran tests with OBJC_DEBUG_MISSING_POOLS=YES and verified that we are not adding leaks. And the impact of this change is actually small since most resources are only created once on initialization and not released on exit.

Copy link
Copy Markdown
Member

@angeloskath angeloskath left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for doing that. It is so much better than before actually...

@zcbenz zcbenz merged commit 282174d into ml-explore:main Mar 25, 2026
16 checks passed
@zcbenz zcbenz deleted the encoder-refactor-2 branch March 25, 2026 02:19
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.

2 participants