SlimDX stops loading large textures after a while

My application from time to time initializes a bunch of DirectX materials and loads scenes, sometimes containing large textures (up to 200-300 MB per texture). At first, everything works fine, but after a while it FromMemory()just stops working, but only for large textures:

SlimDX.Direct3D11.Direct3D11Exception: E_FAIL: An undetermined error occurred (-2147467259)
  at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
  at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
  at SlimDX.Direct3D11.ShaderResourceView.ConstructFromMemory(Device device, Byte[] memory, D3DX11_IMAGE_LOAD_INFO* loadInformation)
  at SlimDX.Direct3D11.ShaderResourceView.FromMemory(Device device, Byte[] memory)

Of course, I download all previously downloaded files ShaderResourceViewbefore downloading a new scene. But FromMemory()it starts working again only after restarting the applications. Could you tell me what else could be wrong?

UPD:

C Texture2D.FromMemory(), I get the following:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
  at D3DX11CreateTextureFromMemory(ID3D11Device* , Void* , UInt32 , D3DX11_IMAGE_LOAD_INFO* , ID3DX11ThreadPump* , ID3D11Resource** , Int32* )
  at SlimDX.Direct3D11.Resource.ConstructFromMemory(Device device, Byte[] memory, D3DX11_IMAGE_LOAD_INFO* info)
  at SlimDX.Direct3D11.Texture2D.FromMemory(Device device, Byte[] memory)

And with source code debugging turned on:

Exception thrown at 0x748AA882 in app.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x00AFC7C8.
Exception thrown: 'System.Runtime.InteropServices.SEHException' in SlimDX.dll

, , D3DX11CreateTextureFromMemory() . , x64...

+4
1

. , , , - "LARGEADDRESSAWARE" . 1 - 300 .

, , , GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce.

, .

+2

Source: https://habr.com/ru/post/1672736/


All Articles