Discussion:
Anyway to force memory flush? or at least to make sure textures are disposed?
(too old to reply)
Wizfrog
2009-05-29 02:03:23 UTC
Permalink
Hello,

I'm having a problem with my app using DirectX in C#.
After a while, I run into OutOfVideoMemory errors even though I am
always using the same amount of data, and I make sure to .Dispose() my
textures, vertexbuffers etc...

So I don't get it. Isn't the Garbage collector supposed to figure out
when the device may run out of memory and flush the space as needed?
I understand that in Managed code, the GC may not flush right when I
ask it to, but it should do so as soon as possible and get rid of
objects to leave room for others.

Now I also undersatand that with the GPU, everything is 'unmanaged' so
to speak, since one needs to 'lock' buffers, texture areas etc... to
write to / read from them.

...but how am I supposed to 'clear' these buffers then, if I am to do
it myself? Assigning a null value doesn't seem to do it.

Thanks for help!!!
Wizfrog
2009-06-01 23:24:08 UTC
Permalink
Just wanted to comment that I found a partial answer in using the
GC.Collect() function that forces Garbage Collection.

Yet I still seem to run into errors after a while...
w***@gmail.com
2009-06-05 16:48:44 UTC
Permalink
Post by Wizfrog
Just wanted to comment that I found a partial answer in using the
GC.Collect() function that forces Garbage Collection.
Yet I still seem to run into errors after a while...
Then you need to find a way for that not to take place.

Loading...