# [.net] Memory leak with TextureLoader.FromFile

## Recommended Posts

Hi All, I'm having a problem with TextureLoader.FromFile - whenever my app exits it reports that I have a memory leak.
texture = TextureLoader.FromFile(CD3DEngine.device, @"..\..\wood.jpg", 256, 256, D3DX.Default, 0, Format.Unknown,
Pool.Managed, Filter.Point, Filter.Point, 0);

This is how I am calling FromFile - now, technically I don't have to use this overloaded method, but I am really interested as to why there is a memory leak.. any ideas?

##### Share on other sites
Mmm.. actually it occurs with whatever FromFile method I use.. and with the DirectX samples in the SDK. Odd..

##### Share on other sites
What is being reported exactly? Are you remembering to call texture.Dispose() upon exit?

##### Share on other sites
Ah - no, I was coding using the unmanaged directx earlier in the day. For some reason, if you have both the managed, and unmanaged debug versions of the SDK enabled you get the errors...

By the way, the error (warning) is:
Quote:

Pretty much the same kind of error that you get when you don't call release on an unmanaged device or object.

##### Share on other sites
I've had similar problems with Managed DX also, and I double-checked that the code disposes all unmanaged objects in reverse creation order. Furthermore, the problem was only evident when using D3DX loaders, just like you describe.

##### Share on other sites
Oh thank god someone else has seen this - I thought I was going mad.. (Although that is a distinct possibility!) ;)

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628395
• Total Posts
2982432

• 10
• 9
• 19
• 24
• 9