Skip to content
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

Texture view leaks #5707

Closed
xiaopengli89 opened this issue May 15, 2024 · 0 comments · Fixed by #5874
Closed

Texture view leaks #5707

xiaopengli89 opened this issue May 15, 2024 · 0 comments · Fixed by #5874
Labels
type: bug Something isn't working

Comments

@xiaopengli89
Copy link
Contributor

Description
Related to #5595

500804e only clean up the suspected resources, weak pointers will leak if the texture never be dropped.

Repro steps
Minimal reproducible example:

use std::{thread, time::Duration};

fn main() {
    let ins = wgpu::Instance::default();
    let (_adp, dev, que) = pollster::block_on(async {
        let adp = ins.request_adapter(&<_>::default()).await?;
        let (dev, que) = adp.request_device(&<_>::default(), None).await.ok()?;
        Some((adp, dev, que))
    }).unwrap();
    let size = wgpu::Extent3d {
        width: 32,
        height: 32,
        depth_or_array_layers: 1,
    };
    let tex = dev.create_texture(&wgpu::TextureDescriptor {
        label: None,
        size,
        mip_level_count: 1,
        sample_count: 1,
        dimension: wgpu::TextureDimension::D2,
        format: wgpu::TextureFormat::R8Unorm,
        usage: wgpu::TextureUsages::TEXTURE_BINDING,
        view_formats: &[],
    });
    
    loop {
        let _view = tex.create_view(&<_>::default());
        que.submit(None);
        dev.poll(wgpu::Maintain::Wait);

        thread::sleep(Duration::from_secs_f32(1. / 60.));
    }
}

Expected vs observed behavior
Expected: process memory keeps stable
Observed: process memory grows without bound

Extra materials
image

Platform
macOS, wgpu@77a83fb0d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants