Skip to content

Conversation

@lmurray
Copy link
Contributor

@lmurray lmurray commented Jan 4, 2026

D3D12_CreateComputePipeline() currently leaks memory on the success path as it makes a copy of the shader bytecode but never releases it. As D3D12 doesn't need the bytecode to remain valid after the call to ID3D12Device_CreateComputePipelineState() it's possible to use the original bytecode and avoid the copy outright.

This PR was made blindly via the GitHub website. I have not tested this change directly.

@slouken
Copy link
Collaborator

slouken commented Jan 4, 2026

I'm going to mark this as draft, please let us know when you test it!

@slouken slouken marked this pull request as draft January 4, 2026 23:17
@lmurray
Copy link
Contributor Author

lmurray commented Jan 4, 2026

I no longer use the GPU API in my own projects so I'm unable to test this myself.

@slouken slouken marked this pull request as ready for review January 5, 2026 00:05
@slouken
Copy link
Collaborator

slouken commented Jan 5, 2026

@flibitijibibo, @TheSpydog, can you review this?

Copy link
Collaborator

@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

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

Makes sense, we only need the compiled shader handle and now the raw bytecode.

@slouken
Copy link
Collaborator

slouken commented Jan 5, 2026

@flibitijibibo, are you able to actually test this?

@flibitijibibo
Copy link
Collaborator

Not for a while since my only compute cases are the examples. @thatcosmonaut may be able to look once he's back in the office.

@slouken slouken requested a review from thatcosmonaut January 5, 2026 15:13
@slouken slouken added this to the 3.4.2 milestone Jan 5, 2026
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.

3 participants