D3D11CreateDevice with context Memory Leak (VRAM)
See original GitHub issueHi @amerkoleci and happy new year!
I come up with this one that you might want to check:-
public void NoMemoryLeak()
{
D3D11.D3D11CreateDevice(null, DriverType.Hardware, DeviceCreationFlags.BgraSupport, new FeatureLevel[] { FeatureLevel.Level_11_0 }, out ID3D11Device device);
System.Threading.Thread.Sleep(500);
device.Dispose();
}
public void MemoryLeak()
{
D3D11.D3D11CreateDevice(null, DriverType.Hardware, DeviceCreationFlags.BgraSupport, new FeatureLevel[] { FeatureLevel.Level_11_0 }, out ID3D11Device device, out _, out ID3D11DeviceContext context);
System.Threading.Thread.Sleep(500);
context.ClearState();
context.Flush();
context.Dispose();
device.Dispose();
}
And did some test with task manager and the dedicated GPU memory column in details Tab:
Task.Run(() =>
{
while (true)
MemoryLeak();
});
Update: I solved my memory leak issue but I think it was not related it with the above. I just used FlipDiscard instead of Discard. Might FFmpeg messed with my Device not sure yet.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Memory leak in my DX11 program
Notice you are talking about RAM not VRAM, so somehow I doubt it's the actual DX object that leaks. Because buffers are stored...
Read more >Why is there a video memory leak when using ...
Now I find that every time B calls CopyResource to copy the shared texture to the local, the video memory will keep increasing....
Read more >Why does this DirectX call leak memory?
I've been fighting a memory leak in my software, ... HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, pLevels, ...
Read more >Disposing Device seems to leak some memory · Issue #982
Consider code like this: for (int i = 0; i < 1_000_000; i++) { Device d = new Device(SharpDX.Direct3D.DriverType.Hardware); d.
Read more >How can I chase down VRAM & GTT memory leaks?
Probably not. Most OpenGL resources (framebuffers, vertex buffer objects, textures &c.) are controlled by host code (i.e. your C++ code), ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you try with 2.1.1-beta5 release?
Looks ok now