Could c# garbage collection crash my opengl program?

I've used vbo's and call lists on my own laptop for a while without problems. But some times when running my app on other computers, crashes occur out of the blue.

Could this have something to do with the c# carbage collector?

Whap happens if the gfx cards runs out of memory?

Could this have something to

Could this have something to do with the c# carbage collector?
In a word, yes.

The collector runs on a different thread, which does not have an OpenGL context. This means that any OpenGL functions inside object finalizers will *crash*.

Use the disposable pattern instead, and manually free all OpenGL resources. Another solution is to resurrect dead objects from their finalizers and destroy them in the main thread.

In any case, running out of video memory may result in OpenGL errors, which you can detect with GL.glGetError().

------
OpenTK

Thanks for the hints. I'm

Thanks for the hints. I'm only accessing gl from one thread, so that probably isn't the problem. Also, already calling glGetError() at the end of each frame, but I never get to it, because of the crash.

Often it is at glCallList(), and the exception is some kind of memory access violation.

hm, do you, make sure you

hm, do you, make sure you don't access any opengl functions before the context is created, as this might cause problems.

- sorry for the lack of capitals, that's what you get for using release candidates for your operating system -

------
OpenTK

This is a stack trace i got

This is a stack trace i got from a crash

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Tao.OpenGl.Gl.Imports.CallList(UInt32 list)
at Tao.OpenGl.Gl.glCallList(Int32 list)
at Eiva3D.GMesh.DrawMesh(GLParameters Glp)

I see that glCallList() fails, drawing my GMesh object. When building this list I parse float arrays for material properties glMaterialfv().

Could it be that the garbage collector moved this array? So that the pointer I parsed to gl is now invalid?

I don't think this is about

I don't think this is about garbage collection. I found that the glCallList fails only if I have vbo's in the same scene. The object is renderig fine, but as soon as I add another objects that renders using vbo's, I see this crash. How can I get closer to a solution. Why could glCallList fail?

Please see my comment in

Please see my comment in next thread:

AccessViolationException on glCallList()

Hope I found the problem...

Theme by La Boite a site | Powered by Drupal