dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.05k stars 1.17k forks source link

High memory consumption or memory leak on Intel integrated graphics #7704

Open EdiWang opened 1 year ago

EdiWang commented 1 year ago

Description

WPF application running on some Intel integrated graphics card is taking a lot more memory than it should. Even a pure empty WPF app takes 165.2 MB on startup.

3aedc63e2047a93783dd15d5ac35848

On other machine without Intel graphics, or disabling intel graphics card, or use software rendering, the memory consumption is normal.

1ea5fdd519f495d74ada897df20fedb

There are two threads on Intel community site describing the same issue. But I am not sure if this is a WPF issue or Intel issue.

https://community.intel.com/t5/Graphics/Net-WPF-Application-high-memory-consumption/td-p/1434020 https://community.intel.com/t5/Graphics/UHD710-High-memory-usage-and-memory-leak-issues-with-WPF/m-p/1471504

Reproduction Steps

Expected behavior

Memory usage is around 10-30 MB

Actual behavior

Memory usage is around 150 MB

Regression?

No response

Known Workarounds

Set the WPF app to use software rendering.

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
    }
}

Impact

Users with some type of Intel graphics will have much more memory usage and potentially slow down their system.

Configuration

Other information

This issue does not happen to

Attaching the WPF app used for testing this

WpfApp1.zip

Memory consumption also has something to do with monitors:

It doesn't matter which screen the App is on, the more screens, the more memory usage.

No response

Anduin2017 commented 1 year ago

Looks good on my machine....

1b684de70856fac3e6e36d05342480c

adbff5c72f64d9bb4f311c76babb400

EdiWang commented 1 year ago

@Anduin2017 You are using NVIDIA GPU, so you don't have this issue. It only happens to a few Intel CPU with integrated GPU.

Credhat commented 1 year ago

I am also confused about this issue. It is difficult to understand why a simple Net6.0 WPF application would result in such high memory consumption.

Here is some additional information. I hope this issue can be resolved. WPF Task Manager

Dxdiag Info

phreishauer commented 1 year ago

We have the same issue on a few recent Dell Laptops with 12th Gen Intel CPUs. In our case (32bit application) it leads to OutOfMemory and other exceptions in strange places.

qkevin commented 1 year ago

i can confirm this issue happens with my 12th Gen Intel CPU 12500 with integrated GPU 770, i created an empty wpf app, can confirm it consumes 100mb more memory in task manager. Snipaste_2023-07-18_14-01-56

allopatin commented 1 year ago

We are also encountering this issue. It's not only limited to what you described. In our case a static Image source is breaking the application completely in addition to exploding memory usage. The error we sometimes are able to catch is System.Runtime.InteropServices.COMException: 'UCEERR_RENDERTHREADFAILURE (Exception from HRESULT: 0x88980406)' which could suggest a driver issue. On a machine with 31.0.101.3251 Intel driver the implementation does not show this behaviour and works without issues.

eduardoghi commented 1 year ago

The problem is happening to me too

image

image

image

image

Xulunix commented 1 year ago

We have escalated this issue through our hardware distributor to Intel and Microsoft. Sadly, it looks like none of them are ready do acknowledge the issue and instead try to blame the other party for it and hope to wait it out.

As it is only a problem on Intel GPUs with the Intel drivers enabled, i would suggest to contact Intel support if you are affected. Responding to the existing forum threads does not work as threads get ignored after a few weeks. Use a new thread or other channels and reference this issue. Maybe things start to move if enough report it.

pchaurasia14 commented 1 year ago

We are currently following with the DirectX team internally for this bug. It looks like there is an issue with D3D9On12 abstraction which is causing the spike in memory usage.

We will update you as soon as we know more.

DanielF95 commented 11 months ago

The problems are so obviously! - (and after 2 hours of research you can see that the problem comes at the time when microsoft changes the concept to the new wrapper D3D9On12). I can't understand why microsoft or/and intel ignores this bug. Many user have this problem since over one year !

shennig commented 11 months ago

We are currently following with the DirectX team internally for this bug. It looks like there is an issue with D3D9On12 abstraction which is causing the spike in memory usage.

We will update you as soon as we know more.

Do you have news from this issue? We are currently struggeling with this problem and it is very urgent, that we get a solution! We will appreciate every kind of help.

PsychoDad9999 commented 11 months ago

Memory consumption of a Fullscreen WPF application on a 4K UHD Display + Intel GPU is insane. Using Software rendering fixes the issues, but we would prefer a better solution.

Our telemetrics currently shows a lot of OutOfMemory and RenderThreadFailure Exceptions and the majority of our target devices are using these gpus. Hope this will be fixed soon.

Onnotjee commented 11 months ago

Same issue here.

Hardware:

Software:

The workaround solution mentioned to use software rendering works indeed, but is not preferred.

sm99sensors commented 10 months ago

We have the same problem Out of memory issues with our WPF based software. At both x32 and x64 builds, .NET 4.8.

Device specs: image

image

Test WpfApp consumes abnormal 345 MB
image

CrazyWinner commented 10 months ago

Same thing on UHD630. It's a driver issue. Anything that uses GPU will leak memory no matter what(Tried with Qt and glfw). We have been having problems with Intel igpu's since 2021 and seems like Intel just doesn't care. What a trash company

Tracy-P commented 10 months ago

I see the same happening on a Dell All-in-One with the Intel Iris Xe Graphics hardware.

Operating System: Microsoft Windows 11 Home 10.0.22621
IGCC Version: 1.100.5237.0
Language: en-US
Physical Memory: 63.7 GB 
Current Resolution: 1920x1080

Processor: 12th Gen Intel(R) Core(TM) i7-1255U
Processor Speed: 1700 MHz
GFX Driver Name: Intel® Iris® Xe Graphics
Shader Version: 5.1
OpenCL* Version: 3.0
* Microsoft DirectX* *
Runtime Version: 12
Hardware-Supported Version: 12
Vendor ID: 8086
Device ID: 46A8
Device Revision: 0C
GFX Driver Version: 31.0.101.4502
Dedicated RAM: 128 MB
Shared RAM: 32 GB
Max Supported Displays: 4
GFX Vulcan: 1.3.250
GFX GOP: 21.0.1046

The project is a new WPF .NET 6 with no modifications. image

and with

RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

image

lindexi commented 9 months ago

Reference https://github.com/microsoft/D3D9On12/issues/72

lindexi commented 4 months ago

The version of Intel® Graphics Driver is 31.0.101.5534 now. Could you retest this issues? @EdiWang

EdiWang commented 4 months ago

@lindexi I tested the latest driver, 31.0.101.5534 with the same hardware. This issue remains.

Xulunix commented 4 months ago

I can confirm that the issue remains on 31.0.101.5534 An empty unmodified WPF application still uses ~100Mb memory. An i noticed that window size affects consumed memory

lindexi commented 3 months ago

This could just be counting the GPU memory into memory usage.

lindexi commented 3 months ago

Sorry, I clicked the wrong button.

zerodev1200 commented 3 months ago

In the following environment, an empty WPF (.NET 8) application consumes approximately 650MB:

OS: Windows 11 Pro 23H2 CPU: Core Ultra 7 155H GPU: Intel Arc Graphics Memory: 32GB Display: 3840x2400 Intel Driver Version: Intel Arc Graphics 31.0.101.5007 Executing with RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; reduces the consumption to about 41MB.

LiguangZhang commented 2 months ago

same issues on utra5 laptop using latest intel graphic driver.

lindexi commented 2 months ago

@LiguangZhang What is your intel graphic driver version? You can find the version of intel graphic driver in TaskManager.

任务管理器里面的 性能->GPU 里面可以看到 驱动程序版本

ali50m commented 2 months ago

same issue, Intel(R) Iris(R) Xe Graphics version: 31.0.101.4146

lindexi commented 2 months ago

Based on my analysis, this issue arises when using D3D9On12, as the memory that should be counted or stored in the GPU memory is instead accounted for in the WPF application. As indicated by the following stack traces, when wpfgfx_cor3.dll!CD3DDeviceManager::CreateNewDevice creates a device, the resources created are requested in the current WPF application by igdgmm64.dll. Since I am unable to fetch symbols from https://software.intel.com/sites/downloads/symbols, I am uncertain about which functions igdgmm64.dll has invoked.

Most1

igdgmm64.dll!0x7fff6653a554()
ntdll.dll!QueryRegistryValue() - line 0
igdgmm64.dll!0x7fff665511e0()
igdgmm64.dll!0x7fff6654f491()
igdgmm64.dll!0x7fff66535610()
igdgmm64.dll!0x7fff6653b768()
igdgmm64.dll!0x7fff66539fce()
igdgmm64.dll!0x7fff6653d502()
igdgmm64.dll!0x7fff66536d99()
igdgmm64.dll!0x7fff665399e6()
igd12um64xel.dll!0x7fff15ac3ddb()
igd12um64xel.dll!0x7fff15ac3c94()
igd12um64xel.dll!0x7fff15d0577d()
igd12um64xel.dll!0x7fff15d0b394()
igd12um64xel.dll!0x7fff15d610fe()
igd12um64xel.dll!0x7fff15b1c896()
D3D12Core.dll!CDevice::VersionedCreateHeapAndResource(struct D3D12DDIARG_CREATEHEAP_0001 const *,struct D3D12DDI_HHEAP,struct D3D10DDI_HRTRESOURCE,struct D3D12DDIARG_CREATERESOURCE_0088 const *,struct D3D12DDI_CLEAR_VALUES const *,struct D3D12DDI_HPROTECTEDRESOURCESESSION_0030,struct D3D10DDI_HRESOURCE)() - line 0
D3D12Core.dll!CResource::FinalConstruct(struct SD3D12LayeredResourceCreationArgs const &)() - line 0
D3D12Core.dll!CLayeredObject<class CResource>::CreateInstance(struct SD3D12LayeredResourceCreationArgs const &,void *,void *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CBridgeImpl<struct ID3D12LayeredDevice,struct ID3D12LayeredDevice,class CLayeredObject<class NDXGI::CDevice> >::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12.dll!NOutermost::CDevice::CreateLayeredChild() - line 0
D3D12Core.dll!CHeap::FinalConstruct(struct SD3D12LayeredHeapCreationArgs const &)() - line 0
D3D12Core.dll!CLayeredObject<class CHeap>::CreateInstance(struct SD3D12LayeredHeapCreationArgs const &,void *,void *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CBridgeImpl<struct ID3D12LayeredDevice,struct ID3D12LayeredDevice,class CLayeredObject<class NDXGI::CDevice> >::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12.dll!NOutermost::CDevice::CreateLayeredChild() - line 0
D3D12Core.dll!public: long __cdecl CDevice::CreateTestResourceAndHeap_Worker<enum D3D12_RESOURCE_STATES>(struct D3D12_HEAP_DESC const *,enum D3D12TEST_HEAP_FLAGS,struct ID3D12Heap *,struct ID3D12Resource *,unsigned __int64,void *,struct D3D12_RESOURCE_DESC1 const *,struct D3D11_RESOURCE_FLAGS const *,enum D3D12TEST_RESOURCE_FLAGS,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct ID3D12ProtectedResourceSession *,struct ID3D12LifetimeTracker *,struct ID3D12SwapChainAssistant *,unsigned int,enum DXGI_FORMAT *,struct _GUID const &,void * *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateCommittedResource_Worker<enum D3D12_RESOURCE_STATES>(struct D3D12_HEAP_PROPERTIES const *,enum D3D12_HEAP_FLAGS,struct D3D12_RESOURCE_DESC1 const *,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct ID3D12ProtectedResourceSession *,unsigned int,enum DXGI_FORMAT *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateCommittedResource(struct D3D12_HEAP_PROPERTIES const *,enum D3D12_HEAP_FLAGS,struct D3D12_RESOURCE_DESC const *,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct _GUID const &,void * *)() - line 0
d3d9on12.dll!<lambda_dd79be98c10bc93fda9e998d88fd59bc>::operator()() - line 0
d3d9on12.dll!D3D12TranslationLayer::ImmediateContext::TryAllocateResourceWithFallback<<lambda_dd79be98c10bc93fda9e998d88fd59bc> >() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::CreateUnderlying(enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::Create(enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::CreateResource(class D3D12TranslationLayer::ImmediateContext *,struct D3D12TranslationLayer::ResourceCreationArgs &,enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D9on12::Resource::CreateUnderlyingResource(struct D3D12TranslationLayer::ResourceCreationArgs &)() - line 0
d3d9on12.dll!D3D9on12::ResourceInternal::CreateUnderlyingResource(struct D3D12TranslationLayer::ResourceCreationArgs &,struct _D3DDDIARG_CREATERESOURCE2 &)() - line 0
d3d9on12.dll!D3D9on12::Resource::InitInternal(struct _D3DDDIARG_CREATERESOURCE2 &,bool,struct D3D12TranslationLayer::unique_comptr<class D3D12TranslationLayer::Resource,struct D3D12TranslationLayer::unique_comptr_deleter>,bool)() - line 0
d3d9on12.dll!D3D9on12::Resource::Init(struct _D3DDDIARG_CREATERESOURCE2 &)() - line 0
d3d9on12.dll!D3D9on12::DeviceInternal::CreateResource2(void *,struct _D3DDDIARG_CREATERESOURCE2 *)() - line 0
d3d9.dll!CreateSurfaceLH() - line 0
d3d9.dll!DdCreateSurfaceLH() - line 0
d3d9.dll!DdCreateSurfaceFilter() - line 0
d3d9.dll!CDriverSurface::CDriverSurface() - line 0
d3d9.dll!CSwapChain::CreateWindowed() - line 0
d3d9.dll!CSwapChain::Reset() - line 0
d3d9.dll!CSwapChain::Init(struct _D3DPRESENT_PARAMETERS_ *,struct D3DDISPLAYMODEEX const *,long *,int,int)() - line 0
d3d9.dll!CBaseDevice::Init() - line 0
d3d9.dll!CEnum::CreateDeviceImpl() - line 0
d3d9.dll!CEnum::CreateDeviceEx() - line 0
wpfgfx_cor3.dll!CD3DDeviceManager::CreateNewDevice() - line 1606
wpfgfx_cor3.dll!CD3DDeviceManager::GetD3DDeviceAndPresentParams() - line 1050
wpfgfx_cor3.dll!CHwDisplayRenderTarget::Create() - line 69
wpfgfx_cor3.dll!CDesktopRenderTarget::Init() - line 338
wpfgfx_cor3.dll!CDesktopRenderTarget::Create() - line 124
wpfgfx_cor3.dll!CMILFactory::CreateDesktopRenderTarget() - line 684
wpfgfx_cor3.dll!CSlaveHWndRenderTarget::EnsureRenderTargetInternal() - line 884
wpfgfx_cor3.dll!CSlaveHWndRenderTarget::Render() - line 88
wpfgfx_cor3.dll!CRenderTargetManager::Render() - line 339
wpfgfx_cor3.dll!CComposition::Render() - line 859
wpfgfx_cor3.dll!CComposition::ProcessComposition() - line 712
wpfgfx_cor3.dll!CComposition::Compose() - line 805
wpfgfx_cor3.dll!CPartitionThread::RenderPartition() - line 134
wpfgfx_cor3.dll!CPartitionThread::Run() - line 246
wpfgfx_cor3.dll!CPartitionThread::ThreadMain() - line 51
kernel32.dll!BaseThreadInitThunk() - line 0

Most2

igdgmm64.dll!0x7fff6654f491()
ntdll.dll!QueryRegistryValue() - line 0
igdgmm64.dll!0x7fff665511e0()
igdgmm64.dll!0x7fff66535610()
igdgmm64.dll!0x7fff6653b768()
igdgmm64.dll!0x7fff6653a554()
igdgmm64.dll!0x7fff66539fce()
igdgmm64.dll!0x7fff6653d600()
igdgmm64.dll!0x7fff66536d99()
igdgmm64.dll!0x7fff665399e6()
igd12um64xel.dll!0x7fff15ac3ddb()
igd12um64xel.dll!0x7fff15ac3c94()
igd12um64xel.dll!0x7fff15d0577d()
igd12um64xel.dll!0x7fff15d0b394()
igd12um64xel.dll!0x7fff15d610fe()
igd12um64xel.dll!0x7fff15b1c896()
D3D12Core.dll!CDevice::VersionedCreateHeapAndResource(struct D3D12DDIARG_CREATEHEAP_0001 const *,struct D3D12DDI_HHEAP,struct D3D10DDI_HRTRESOURCE,struct D3D12DDIARG_CREATERESOURCE_0088 const *,struct D3D12DDI_CLEAR_VALUES const *,struct D3D12DDI_HPROTECTEDRESOURCESESSION_0030,struct D3D10DDI_HRESOURCE)() - line 0
D3D12Core.dll!CResource::FinalConstruct(struct SD3D12LayeredResourceCreationArgs const &)() - line 0
D3D12Core.dll!CLayeredObject<class CResource>::CreateInstance(struct SD3D12LayeredResourceCreationArgs const &,void *,void *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CBridgeImpl<struct ID3D12LayeredDevice,struct ID3D12LayeredDevice,class CLayeredObject<class NDXGI::CDevice> >::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12.dll!NOutermost::CDevice::CreateLayeredChild() - line 0
D3D12Core.dll!CHeap::FinalConstruct(struct SD3D12LayeredHeapCreationArgs const &)() - line 0
D3D12Core.dll!CLayeredObject<class CHeap>::CreateInstance(struct SD3D12LayeredHeapCreationArgs const &,void *,void *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CBridgeImpl<struct ID3D12LayeredDevice,struct ID3D12LayeredDevice,class CLayeredObject<class NDXGI::CDevice> >::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredUseCounted *,struct _GUID const &,void * *)() - line 0
D3D12.dll!NOutermost::CDevice::CreateLayeredChild() - line 0
D3D12Core.dll!public: long __cdecl CDevice::CreateTestResourceAndHeap_Worker<enum D3D12_RESOURCE_STATES>(struct D3D12_HEAP_DESC const *,enum D3D12TEST_HEAP_FLAGS,struct ID3D12Heap *,struct ID3D12Resource *,unsigned __int64,void *,struct D3D12_RESOURCE_DESC1 const *,struct D3D11_RESOURCE_FLAGS const *,enum D3D12TEST_RESOURCE_FLAGS,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct ID3D12ProtectedResourceSession *,struct ID3D12LifetimeTracker *,struct ID3D12SwapChainAssistant *,unsigned int,enum DXGI_FORMAT *,struct _GUID const &,void * *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateCommittedResource_Worker<enum D3D12_RESOURCE_STATES>(struct D3D12_HEAP_PROPERTIES const *,enum D3D12_HEAP_FLAGS,struct D3D12_RESOURCE_DESC1 const *,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct ID3D12ProtectedResourceSession *,unsigned int,enum DXGI_FORMAT *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!CDevice::CreateCommittedResource(struct D3D12_HEAP_PROPERTIES const *,enum D3D12_HEAP_FLAGS,struct D3D12_RESOURCE_DESC const *,enum D3D12_RESOURCE_STATES,struct D3D12_CLEAR_VALUE const *,struct _GUID const &,void * *)() - line 0
d3d9on12.dll!<lambda_dd79be98c10bc93fda9e998d88fd59bc>::operator()() - line 0
d3d9on12.dll!D3D12TranslationLayer::ImmediateContext::TryAllocateResourceWithFallback<<lambda_dd79be98c10bc93fda9e998d88fd59bc> >() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::CreateUnderlying(enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::Create(enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D12TranslationLayer::Resource::CreateResource(class D3D12TranslationLayer::ImmediateContext *,struct D3D12TranslationLayer::ResourceCreationArgs &,enum D3D12TranslationLayer::ResourceAllocationContext)() - line 0
d3d9on12.dll!D3D9on12::Resource::CreateUnderlyingResource(struct D3D12TranslationLayer::ResourceCreationArgs &)() - line 0
d3d9on12.dll!D3D9on12::ResourceInternal::CreateUnderlyingResource(struct D3D12TranslationLayer::ResourceCreationArgs &,struct _D3DDDIARG_CREATERESOURCE2 &)() - line 0
d3d9on12.dll!D3D9on12::Resource::InitInternal(struct _D3DDDIARG_CREATERESOURCE2 &,bool,struct D3D12TranslationLayer::unique_comptr<class D3D12TranslationLayer::Resource,struct D3D12TranslationLayer::unique_comptr_deleter>,bool)() - line 0
d3d9on12.dll!D3D9on12::Resource::Init(struct _D3DDDIARG_CREATERESOURCE2 &)() - line 0
d3d9on12.dll!D3D9on12::DeviceInternal::CreateResource2(void *,struct _D3DDDIARG_CREATERESOURCE2 *)() - line 0
d3d9.dll!CreateSurfaceLH() - line 0
d3d9.dll!DdCreateSurfaceLH() - line 0
d3d9.dll!DdCreateSurfaceFilter() - line 0
d3d9.dll!CDriverSurface::CDriverSurface() - line 0
d3d9.dll!CSwapChain::CreateWindowed() - line 0
d3d9.dll!CSwapChain::Reset() - line 0
d3d9.dll!CSwapChain::Init(struct _D3DPRESENT_PARAMETERS_ *,struct D3DDISPLAYMODEEX const *,long *,int,int)() - line 0
d3d9.dll!CBaseDevice::Init() - line 0
d3d9.dll!CEnum::CreateDeviceImpl() - line 0
d3d9.dll!CEnum::CreateDeviceEx() - line 0
wpfgfx_cor3.dll!CD3DDeviceManager::CreateNewDevice() - line 1606
wpfgfx_cor3.dll!CD3DDeviceManager::GetD3DDeviceAndPresentParams() - line 1050
wpfgfx_cor3.dll!CHwDisplayRenderTarget::Create() - line 69
wpfgfx_cor3.dll!CDesktopRenderTarget::Init() - line 338
wpfgfx_cor3.dll!CDesktopRenderTarget::Create() - line 124
wpfgfx_cor3.dll!CMILFactory::CreateDesktopRenderTarget() - line 684
wpfgfx_cor3.dll!CSlaveHWndRenderTarget::EnsureRenderTargetInternal() - line 884
wpfgfx_cor3.dll!CSlaveHWndRenderTarget::Render() - line 88
wpfgfx_cor3.dll!CRenderTargetManager::Render() - line 339
wpfgfx_cor3.dll!CComposition::Render() - line 859
wpfgfx_cor3.dll!CComposition::ProcessComposition() - line 712
wpfgfx_cor3.dll!CComposition::Compose() - line 805
wpfgfx_cor3.dll!CPartitionThread::RenderPartition() - line 134
wpfgfx_cor3.dll!CPartitionThread::Run() - line 246
wpfgfx_cor3.dll!CPartitionThread::ThreadMain() - line 51
kernel32.dll!BaseThreadInitThunk() - line 0

The difference between Most1 and Most2 is: igdgmm64.dll!0x7fff6653d502() and igdgmm64.dll!0x7fff6653d600()

Most3:

igdgmm64.dll!0x7fff66538841()
ntdll.dll!QueryRegistryValue() - line 0
igdgmm64.dll!0x7fff665511e0()
igdgmm64.dll!0x7fff66548a2f()
igdgmm64.dll!0x7fff6653c810()
igdgmm64.dll!0x7fff66538c3a()
igdgmm64.dll!0x7fff6654014f()
igdgmm64.dll!0x7fff665401c1()
igd12um64xel.dll!0x7fff15aefb94()
igd12um64xel.dll!0x7fff15ac00bc()
igd12um64xel.dll!0x7fff15aefd53()
igd12um64xel.dll!0x7fff15acfa35()
D3D12Core.dll!NDXGI::CDevice::CreateDriverInstance(void *,void *,void *,enum D3D12DDI_CREATE_DEVICE_FLAGS)() - line 0
D3D12Core.dll!CDevice::LLOCompleteLayerConstruction(void)() - line 0
D3D12Core.dll!NDXGI::CDevice::LLOCompleteLayerConstruction(void)() - line 0
D3D12.dll!D3D12CreateLayeredDevice(unsigned int,void const *,unsigned __int64,struct ID3D12LayeredDevice *,struct _GUID const &,void * *)() - line 0
D3D12Core.dll!D3D12CoreCreateLayeredDevice() - line 0
D3D12Core.dll!D3D12CoreCreateDevice() - line 0
D3D12Core.dll!D3D12ValidateAndCreateDevice() - line 0
D3D12.dll!D3D12CreateDeviceImpl(struct IUnknown *,enum D3D_FEATURE_LEVEL,struct _GUID const &,void * *)() - line 0
D3D12.dll!D3D12CreateDevice() - line 0
d3d9on12.dll!D3D9on12::Adapter::Adapter(struct _D3DDDIARG_OPENADAPTER &,struct _LUID *,struct _D3D9ON12_CREATE_DEVICE_ARGS *)() - line 0
d3d9on12.dll!D3D9on12::AdapterInternal::OpenAdapter_Internal(struct _D3DDDIARG_OPENADAPTER *,struct _LUID *,struct _D3D9ON12_CREATE_DEVICE_ARGS *)() - line 0
d3d9.dll!D3DFE_PVFUNCSI::LoadShaderConstants(unsigned int,unsigned int,void *)() - line 0
d3d9.dll!D3D9CreateDirectDrawObject() - line 0
d3d9.dll!FetchDirectDrawData() - line 0
d3d9.dll!InternalDirectDrawCreate() - line 0
d3d9.dll!CEnum::CEnum() - line 0
d3d9.dll!Direct3DCreate9Impl() - line 0
d3d9.dll!Direct3DCreate9Ex() - line 0
wpfgfx_cor3.dll!CD3DModuleLoaderInternal::CreateD3DObjects() - line 434
wpfgfx_cor3.dll!CDisplaySet::Init() - line 996
wpfgfx_cor3.dll!CDisplayManager::CreateNewDisplaySet() - line 666
wpfgfx_cor3.dll!CDisplayManager::DangerousGetLatestDisplaySet() - line 449
wpfgfx_cor3.dll!CMILFactory::GetCurrentDisplaySet() - line 733
wpfgfx_cor3.dll!CMILFactory::UpdateDisplayState() - line 414
wpfgfx_cor3.dll!CComposition::ProcessComposition() - line 616
wpfgfx_cor3.dll!CComposition::Compose() - line 805
wpfgfx_cor3.dll!CPartitionThread::RenderPartition() - line 134
wpfgfx_cor3.dll!CPartitionThread::Run() - line 246
wpfgfx_cor3.dll!CPartitionThread::ThreadMain() - line 51
kernel32.dll!BaseThreadInitThunk() - line 0

Thanks to my friends for providing DUMP file.

xsswon commented 2 months ago

Also on Ultra5 laptop with Intel(R) Arc(TM) Graphics(version:31.0.101.5449)

CainSakura commented 1 month ago

Same issue on desktop with Intel Arc A770 Limited Edition. Driver version 31.0.101.5590 and 32.0.101.5768

ShannonZ commented 1 month ago

The same issue with Intel HD 630 @ Windows 10 Ennterprise LTSC 2018. The wpf app was based on dotnet 6 and 8 .

ShannonZ commented 1 month ago

Here is a minimal reproduction project Minimizing the window would cause a sudden memory consumption with Intel HD630. The app has no business logic. But after being minimized, it consumes about 40GB memory.

ShannonZ commented 1 month ago

Nvidia Geforce GT 710 and ATI 6750 also have the same issue.

lindexi commented 1 month ago

@ShannonZ Can you sure your process load d3d9on12.dll ?

ShannonZ commented 1 month ago

@ShannonZ Can you sure your process load d3d9on12.dll ?

Those old graphic cards (7th core CPU with UHD630, GT710) natively support D3D9. No D3D9On12 Wrapper.

lindexi commented 1 month ago

@ShannonZ Could you take the dump file and send the dump file to me or share it? I clone your repo but find nothing.

ShannonZ commented 1 month ago

@ShannonZ Could you take the dump file and send the dump file to me or share it? I clone your repo but find nothing.

3GB version

lindexi commented 1 month ago

@ShannonZ Could you take the dump file and send the dump file to me or share it? I clone your repo but find nothing.

3GB version

@ShannonZ Thank you.

I can sure your process do not load the D3D9On12.dll and the process take the 3GB memory

> !address -summary

Mapping file section regions...
Mapping module regions...
Mapping PEB regions...
Mapping TEB and stack regions...
Mapping heap regions...
Mapping page heap regions...
Mapping other regions...
Mapping stack trace database regions...
Mapping activation context regions...

--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free                                    176     7dfd`fc035000 ( 125.992 TB)           98.43%
<unknown>                              2064      201`ed3ac000 (   2.008 TB)  99.98%    1.57%
Image                                   768        0`1155c000 ( 277.359 MB)   0.01%    0.00%
Heap                                     62        0`021ab000 (  33.668 MB)   0.00%    0.00%
Stack                                    54        0`01b00000 (  27.000 MB)   0.00%    0.00%
Other                                    18        0`019e3000 (  25.887 MB)   0.00%    0.00%
TEB                                      18        0`00024000 ( 144.000 kB)   0.00%    0.00%
PEB                                       1        0`00001000 (   4.000 kB)   0.00%    0.00%

--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_MAPPED                              230      200`040b5000 (   2.000 TB)  99.61%    1.56%
MEM_PRIVATE                            1987        1`ee9aa000 (   7.728 GB)   0.38%    0.01%
MEM_IMAGE                               768        0`1155c000 ( 277.359 MB)   0.01%    0.00%

--- State Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_FREE                                176     7dfd`fc035000 ( 125.992 TB)           98.43%
MEM_RESERVE                             273      201`2dee9000 (   2.005 TB)  99.84%    1.57%
MEM_COMMIT                             2712        0`d60d2000 (   3.345 GB)   0.16%    0.00%

--- Protect Summary (for commit) - RgnCount ----------- Total Size -------- %ofBusy %ofTotal
PAGE_READWRITE                         1896        0`beae1000 (   2.979 GB)   0.14%    0.00%
PAGE_READONLY                           476        0`09d5f000 ( 157.371 MB)   0.01%    0.00%
PAGE_EXECUTE_READ                       115        0`090d5000 ( 144.832 MB)   0.01%    0.00%
PAGE_NOACCESS                            88        0`03b51000 (  59.316 MB)   0.00%    0.00%
PAGE_WRITECOPY                           97        0`00a4f000 (  10.309 MB)   0.00%    0.00%
PAGE_EXECUTE_READWRITE                   21        0`001e3000 (   1.887 MB)   0.00%    0.00%
PAGE_READWRITE|PAGE_GUARD                18        0`00038000 ( 224.000 kB)   0.00%    0.00%
PAGE_READWRITE|PAGE_WRITECOMBINE          1        0`00002000 (   8.000 kB)   0.00%    0.00%

--- Largest Region by Usage ----------- Base Address -------- Region Size ----------
Free                                    23f`6fa20000     7bb5`8d440000 ( 123.709 TB)
<unknown>                              7dfe`f9d4d000      1f6`e2efa000 (   1.964 TB)
Image                                  7ffb`1d96e000        0`02308000 (  35.031 MB)
Heap                                    23f`11082000        0`0099d000 (   9.613 MB)
Stack                                    f0`9a000000        0`0017b000 (   1.480 MB)
Other                                   23e`806f0000        0`0178d000 (  23.551 MB)
TEB                                      f0`9992d000        0`00002000 (   8.000 kB)
PEB                                      f0`9992c000        0`00001000 (   4.000 kB)

As you can see, the MEM_COMMIT (Committed memory) take 3.345 GB memory. In the other hand, the PAGE_READWRITE (Memory that is readable and writable, but not executable) take 2.979 GB.

> !eeheap -gc

========================================
Number of GC Heaps: 1
----------------------------------------
generation 0 starts at 23e842263d0
generation 1 starts at 23e84221bb8
generation 2 starts at 23e83b81000
ephemeral segment allocation context: none
Small object heap
         segment            begin        allocated        committed allocated size       committed size      
    023e83b80000     023e83b81000     023e8451c3e8     023e84dc2000 0x99b3e8 (10073064)  0x1242000 (19144704)
Large object heap starts at 23e93b81000
         segment            begin        allocated        committed allocated size       committed size      
    023e93b80000     023e93b81000     023e93b99068     023e93b9a000 0x18068 (98408)      0x1a000 (106496)    
Pinned object heap starts at 23e9bb81000
         segment            begin        allocated        committed allocated size       committed size      
    023e9bb80000     023e9bb81000     023e9bbad608     023e9bbb2000 0x2c608 (181768)     0x32000 (204800)    
------------------------------
GC Allocated Heap Size:    Size: 0x9dfa58 (10353240) bytes.
GC Committed Heap Size:    Size: 0x128e000 (19456000) bytes.

GC Allocated Heap Size: 10353240/1024/1024=9.8736190796MB
GC Committed Heap Size: 19456000/1024/1024=18.5546875MB

As you can see, the .NET take the small memory usage.

>  !heap -s 

************************************************************************************************************************
                                              NT HEAP STATS BELOW
************************************************************************************************************************
NtGlobalFlag enables following debugging aids for new heaps:
    stack back traces
LFH Key                   : 0x5a6b0864797ae626
Termination on corruption : ENABLED
          Heap     Flags   Reserv  Commit  Virt   Free  List   UCR  Virt  Lock  Fast 
                            (k)     (k)    (k)     (k) length      blocks cont. heap 
-------------------------------------------------------------------------------------
0000023e81fc0000 08000002   32752  22708  32552    263   250     6    0      2   LFH
0000023e80610000 08008000      64      4     64      2     1     1    0      0      
0000023e83940000 08001002    1280    236   1080      6     5     2    0      0   LFH
0000023e83b40000 08001002      60      8     60      2     1     1    0      0      
0000023e83b30000 08041002      60      8     60      5     1     1    0      0      
0000023ea46d0000 08001002     260     44     60      6     2     1    0      0   LFH
-------------------------------------------------------------------------------------

The heap also take up little memory.

> !address /f:MEM_COMMIT,PAGE_READWRITE
Here are the sorted output
aseAddress,EndAddress+1,RegionSize,Type,State,Protect,Usage,Info
0x0000023eb6a40000  0x0000023eb8980000  32768000(~31MB) MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023eb8a40000  0x0000023eba980000  32768000(~31MB) MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ebaa50000  0x0000023ebc990000  32768000(~31MB) MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ebca50000  0x0000023ebe990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ebea50000  0x0000023ec0990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ec0a50000  0x0000023ec2990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ec2a50000  0x0000023ec4990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ec4a50000  0x0000023ec6990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ec6a50000  0x0000023ec8990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ec8a50000  0x0000023eca990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ecaa50000  0x0000023ecc990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ecca50000  0x0000023ece990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ecea50000  0x0000023ed0990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ed0a50000  0x0000023ed2990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ed2a50000  0x0000023ed4990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ed4a50000  0x0000023ed6990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ed6a50000  0x0000023ed8990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ed8a50000  0x0000023eda990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023edaa50000  0x0000023edc990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023edca50000  0x0000023ede990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023edea50000  0x0000023ee0990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ee0a50000  0x0000023ee2990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ee2a50000  0x0000023ee4990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ee4a50000  0x0000023ee6990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ee6a50000  0x0000023ee8990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ee8a50000  0x0000023eea990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023eeaa50000  0x0000023eec990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023eeca50000  0x0000023eee990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023eeea50000  0x0000023ef0990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ef0a50000  0x0000023ef2990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ef2a50000  0x0000023ef4990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ef4a50000  0x0000023ef6990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ef6a50000  0x0000023ef8990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023ef8a50000  0x0000023efa990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023efaa50000  0x0000023efc990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023efca50000  0x0000023efe990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023efea50000  0x0000023f00990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f00a50000  0x0000023f02990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f02a50000  0x0000023f04990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f04a50000  0x0000023f06990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f06a50000  0x0000023f08990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f08a50000  0x0000023f0a990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f0aa50000  0x0000023f0c990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f0ca50000  0x0000023f0e990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f0ea50000  0x0000023f10990000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f11a20000  0x0000023f13960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f13a20000  0x0000023f15960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f15a20000  0x0000023f17960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f17a20000  0x0000023f19960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f19a20000  0x0000023f1b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f1ba20000  0x0000023f1d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f1da20000  0x0000023f1f960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f1fa20000  0x0000023f21960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f21a20000  0x0000023f23960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f23a20000  0x0000023f25960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f25a20000  0x0000023f27960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f27a20000  0x0000023f29960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f29a20000  0x0000023f2b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f2ba20000  0x0000023f2d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f2da20000  0x0000023f2f960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f2fa20000  0x0000023f31960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f31a20000  0x0000023f33960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f33a20000  0x0000023f35960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f35a20000  0x0000023f37960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f37a20000  0x0000023f39960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f39a20000  0x0000023f3b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f3ba20000  0x0000023f3d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f3da20000  0x0000023f3f960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f3fa20000  0x0000023f41960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f41a20000  0x0000023f43960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f43a20000  0x0000023f45960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f45a20000  0x0000023f47960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f47a20000  0x0000023f49960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f49a20000  0x0000023f4b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f4ba20000  0x0000023f4d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f4da20000  0x0000023f4f960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f4fa20000  0x0000023f51960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f51a20000  0x0000023f53960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f53a20000  0x0000023f55960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f55a20000  0x0000023f57960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f57a20000  0x0000023f59960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f59a20000  0x0000023f5b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f5ba20000  0x0000023f5d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f5da20000  0x0000023f5f960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f5fa20000  0x0000023f61960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f61a20000  0x0000023f63960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f63a20000  0x0000023f65960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f65a20000  0x0000023f67960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f67a20000  0x0000023f69960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f69a20000  0x0000023f6b960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023f6ba20000  0x0000023f6d960000  32768000    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023eb3e70000  0x0000023eb5750000  26083328    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]
0x0000023e83b80000  0x0000023e84dc2000  19144704    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [.c..............]
0x0000023ead7c0000  0x0000023eae430000  13041664    MEM_PRIVATE MEM_COMMIT  PAGE_READWRITE  <unknown>   [................]

....... // ignore other more memory address

The above memory addresses take about 3GB memory. But I fail to know who alloc this memory.

I'd be even happier if you can use GFlags tool to help address the issues. I find the 0x0000023eb6a40000 address and so on is not the heap address, the GFlags may can not help...

And I can sure what you have is a different problem, and your issurs and this issues are different issues.


Guess:

The address above (0x0000023eb6a40000, 0x0000023eb8a40000, 0x0000023ebaa50000, and so on) takes about 31MB memory. And the 4K screen bitmap will take 3840*2160*4=33177600~31MB about 31MB memory.

I think the address above will be the bitmap memory and the memory of the address above is alloced by the video card driver.

Can I know what is your screen resolution?

ShannonZ commented 1 month ago

@lindexi 1920*1080 This video demonstrates how to reproduce.

Some useful additional info:

  1. Comment the WindowChrome part out in Style could solve the leak problem. But I don't know why; (No minimization button, should press win+D to minimize the window) image;
  2. dotnet framework 4.5,4.7,4.8, dotnet6,8,9 have the same issue;
  3. Software rendering works as expected. And running the same exe on some other graphic cards has no memory leak.
  4. Driver versions from old 27.x to the latest 30.x were tested, no help.
  5. Restore the window to the normal state, those memory would be "released". Video
  6. Discrete Graphics Processing Unit like NVidia Geforce GT 710, ATI 6750 have the same issue. (This is why I think it's a bug of WPF, not graphic card manufacturers.).
ShannonZ commented 2 weeks ago

The same issue with NVIDIA GeForce GTX 1650 and 3050 [2024/09/19]

lindexi commented 2 weeks ago

I still haven't made any progress. Some friends have told me that the animation module may be causing the problem, but I haven't investigated it yet.

我依然没有什么进度。有群友说是动画模块导致的问题,但我还没空调查

ali50m commented 2 weeks ago

@lindexi I think this is a quite serious memory issue. Can we raise the severity of this issue and ask Microsoft to put more resources?

lindexi commented 1 week ago

@ali50m Thank you and I've already sent an internal email.