[vtkusers] VTK & C++/CLI in a multi-threaded application
Oleg Maksimenko
omaksimenko at gmail.com
Thu Jan 10 17:33:43 EST 2013
Hello Colleagues,
I've built some logic around of vtkJPEGReader & vtkPNGReader on C++ and
wrapped them into C++/CLI to make accessible in a .NET 4.5 application. If
the .NET application runs in a single thread - everything is fine. If I
increment the number of threads to 2 or greater - the app fails on
AccessViolationException. Everything also works well in a multi-threaded
context of a sample x64 C++ application. I've made some research and
figured the application fails even if I don't call or use any VTK logic or
classes except of just creating a vtkJPEGReader and use the CLI wrapped
code in a managed multi-threaded context:
vtkJPEGReader::New() or vtkSmartPointer<vtkJPEGReader>::New() - both kill
my stuff in a fraction of a second!
As I said I do not experience any problems or memory leaks running a sample
unmanaged application, so I think this is related to how .NET manages
threads and memory. Got tired of googling this issue, the only thing I've
found so far is this one:
http://comments.gmane.org/gmane.comp.lib.vtk.user/54680 but not sure if
it's related to my problem, and I'd like to hear if somebody knows a
solution or at least a hint...
Thanks in advance!
Oleg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130110/201958c3/attachment.htm>
More information about the vtkusers
mailing list