Reclaiming Vertex Buffer memory
Another noob directX question.
I am using directX 9.
Each object has a vertex buffer created using the CreateVertexBuffer method and then copying vertex information into it.
Everything works and it renders fine.
My question is, after I am done using the object (and the associated vertex buffer), I want to properly reclaim all
memory allocated to the object.
How do I reclaim the memory used by my vertexbuffer (LPDIRECT3DVERTEXBUFFER9)?
(is that what Release() does)
Thanks.
Thanks!
On a somewhat related topic, is there a similar method (is it FreePrivateData) to reclaim memory for a texture (IDirect3DTexture9 ) that is no longer in use.
Thanks again.
On a somewhat related topic, is there a similar method (is it FreePrivateData) to reclaim memory for a texture (IDirect3DTexture9 ) that is no longer in use.
Thanks again.
Use SAFE_RELEASE(object) macro to make sure that you are actually have a memory allocated before releasing. What it does is simply:
if(object) object->Release();
Ofcourse not all D3D objects have release methods so check beforehand.
if(object) object->Release();
Ofcourse not all D3D objects have release methods so check beforehand.
Quote:Original post by DynxWhat ones don't? I can't think of any D3D or D3DX object (class / interface rather than a struct) that doesn't, since it's all COM based, meaning everything derives from IUnknown, which contains the Release() function.
Ofcourse not all D3D objects have release methods so check beforehand.
Quote:
Use SAFE_RELEASE(object) macro to make sure that you are actually have a memory allocated before releasing. What it does is simply:
if(object) object->Release();
Ofcourse not all D3D objects have release methods so check beforehand.
CComPtr<T> is a better choice.
Quote:Original post by Evil SteveQuote:Original post by DynxWhat ones don't? I can't think of any D3D or D3DX object (class / interface rather than a struct) that doesn't, since it's all COM based, meaning everything derives from IUnknown, which contains the Release() function.
Ofcourse not all D3D objects have release methods so check beforehand.
There are some interfaces in the new Direct3D 10 effect framework that are not derives from IUnknown.
Quote:Original post by DemirugAh, I'd forgotten about D3D10 stuff.
There are some interfaces in the new Direct3D 10 effect framework that are not derives from IUnknown.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement