How to release texture 'entirely'

Started by
2 comments, last by daVinci 14 years ago
Hi, guys. I have a very serios issue. This issue blocks my development totally. I have an application with D3D10 render. This application is for image processing, so I have to create & release a lot of textures. Everything works fine, except... I interop with D3D9 device (interop with WPF just for your information). As you know D3D9 (pool default) is limited by dedicated memory (D3D10 use virtualized video memory). What I experience now is D3D9 (WPF) crashes if I render in D3D10 extensively. I have no memory leaks for sure. I call 'resource'->Release() and deveice->Flush(). I think that actually D3D10 do not free dedicated memory after Release & Flush methods. D3D10 waits if I create the same texture, it just return old one. (I checked it, it is true). This is very good optimization, but... After some time D3D9 device experiences lack of free memory and crashes! I am very hope for your help! Thanks, Daniel
Advertisement
Quote:
I think that actually D3D10 do not free dedicated memory after Release & Flush methods. D3D10 waits if I create the same texture, it just return old one. (I checked it, it is true). This is very good optimization, but... After some time D3D9 device experiences lack of free memory and crashes!

Release() decrements the reference count on the object, it does not cause the object to be deallocated in any fashion unless the reference count becomes zero. If you are Release()ing for every (explicit or implicit) AddRef() call you make, you're doing all you can here -- you should absolutely not try to force-fix the issue by calling Release() until the count is zero, because you will almost certainly destabilize the rest of your program.

Similarly, Flush() is just going to empty command buffer queue to the GPU. It won't release resources either, except perhaps as an incidental thing.

If you believe the device is holding on to a resource, you could try calling UnsetAllDeviceObjects.

How are you determining that the memory pressure you are experiencing is caused by D3D resources remaining in existence after you believe they are freed? What profiling tools and metrics are you employing, or are you just guessing because eventually your application runs out of memory?
Quote:Original post by daVinci
What I experience now is D3D9 (WPF) crashes if I render in D3D10 extensively. I have no memory leaks for sure. I call 'resource'->Release() and deveice->Flush().


I'm not that familiar with D3D9, but off the top of my head: You allocating and freeing a lot of resources all the time. Do you do this on different interrupt levels of execution or from multiple threads? If Release, Flush, etc. is not thread-safe, this could lead to a strange behaviour and could cause a crash..

Thank you for you replies.
To trasseltass: I do it in a single thread

To Josh:
I call Release when it is required as written in docs. I pretty sure that I have no leaks becouse I have complex unit tests and when device is released D3D debug layer says me about only two objects (pixel shader & mesh (4 points)). If I could request all alive object in particular moment...

Unfortunately, I can not just call UnsetAllDeviceObjects. I still need some resources to contunue working.

In D3D9 (in WPF) occurs:
[7112] Direct3D9: (ERROR) :BitBlt or StretchBlt failed in Present

It does not occur when I use small textures or when I work with large images, but 'slowly'.

What tools could you suggest me to profile my issue? I would like to see how many free video memeory I have now, for example.

This topic is closed to new replies.

Advertisement