Skip to content

Conversation

iwoplaza
Copy link
Collaborator

Early on, we decided to track buffers and textures that are created using the root. This made sense for creating roots out of already existing devices (tgpu.initFromDevice), as by destroying the root, you would destroy every resource created only with that root. This however increases the risk of leaking memory if the user doesn't properly dispose of allocated resources.

I think we should remove this "feature", in favor of decreasing the risk of introducing memory leaks.

Copy link

github-actions bot commented Sep 30, 2025

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@6fa72b42d969bb3dfdd145066cae6bca6ff9be78
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@6fa72b42d969bb3dfdd145066cae6bca6ff9be78
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@6fa72b42d969bb3dfdd145066cae6bca6ff9be78

benchmark
view benchmark

commit
view commit

@iwoplaza iwoplaza marked this pull request as ready for review October 7, 2025 15:03
Copy link
Collaborator

@cieplypolar cieplypolar left a comment

Choose a reason for hiding this comment

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

tests/root.test.ts > TgpuRoot > .destroy > should call .destroy on all buffers created with it is no longer valid, since device.destroy handles freeing these buffers now.

@iwoplaza iwoplaza requested a review from cieplypolar October 12, 2025 19:50
@iwoplaza iwoplaza merged commit 7d84965 into main Oct 13, 2025
5 checks passed
@iwoplaza iwoplaza deleted the fix/no-tracking-of-buffers branch October 13, 2025 10:34
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