[vtkusers] Garbage collection and .NET problem
David Cole
david.cole at kitware.com
Thu Oct 23 10:10:12 EDT 2008
To avoid the problem, try calling Dispose on any .NET objects associated
with a RenderWindow from the main GUI thread *before* those .NET objects are
out of scope and eligible for garbage collection.
You can also get that error even solely on the main GUI thread if objects
associated with the RenderWindow are not Disposed *before* the render window
itself goes out of scope.
HTH,
David
On Wed, Oct 22, 2008 at 4:44 PM, Serge Lalonde <serge at infolytica.com> wrote:
> Hello all,
>
> I have run into a problem caused by a conflict between the .NET garbage
> collection and the VTK garbage collection. However, I believe that this is a
> general problem that could occur when using Java or even C++ if a vtk object
> were deleted in a different thread.
>
> Because certain objects require that they be freed in the main thread
> (actually the rendering thread) because they need to free OpenGL resources
> in their ReleaseGraphicResources() method (ex: vtkOpenGLTexture), they
> cannot be freed in the .NET garbage collection thread. Doing so causes an
> error in vtkWin32OpenGLRenderWindow::MakeCurrent() at line 218 when calling
> wglMakeCurrent() because the rendering context is not valid for this thread.
>
> I did some digging and found vtkGarbageCollector::DeferredCollectionPush()
> that looked perfect. However, it unfortunately didn't work. There doesn't
> seem to be much documentation on this or in the mailing list.
>
> 1. Does anyone know what DeferredCollectionPush() does and what it is meant
> to actually fix?
> 2. Has anyone run into this problem and if so, how did you fix it?
>
> Thanks.
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081023/8f6c633e/attachment.htm>
More information about the vtkusers
mailing list