With all this in mind (that I'm using a multithreaded environment). Do you think it makes more sense to use vtk's garbage collector or just call .Delete() on every vtk data object I create?<br><br><div class="gmail_quote">
On Tue, Mar 29, 2011 at 12:05 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jonathan,<br>
<div class="im"><br>
> I definitely use one thread to create vtkObjects and then other threads access them in a<br>
> thread safe manner. I thought this was OK.<br>
<br>
</div>This is OK, but if your objects are part of the pipeline which is<br>
rendered, then all the VTK objects (of that pipeline) should be<br>
accessed through the EDT.<br>
<br>
That's precisely why the delete and most of the calls should be done in the EDT.<br>
But if you have a processing loop (Not the EDT) that create a set of<br>
VTK object and you call the GC in the EDT, you have a concurrency<br>
issue here... That's the only thing that I'm saying.<br>
<br>
Seb<br>
<div><div></div><div class="h5"><br>
On Tue, Mar 29, 2011 at 2:55 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> Sorry, I forgot to mention that in all my current test cases I'm calling the<br>
> method cleanSystem(false), so I'm never<br>
> calling vtkGlobalJavaHash.DeleteAll();. In fact you can see in the stack<br>
> trace the following line<br>
> vtk.vtkGlobalJavaHash.GC()I+73<br>
> so I'm definitely not calling DeleteAll(). For threads, I was under the<br>
> impression that vtkGlobalJavaHash.GC() should always be called from the EDT<br>
> if I have any objects that are used for rendering (which I have a bunch of).<br>
> I spent a lot of time making this program work in a multithreaded<br>
> environment. I separated all calls to any rendering objects and do them in<br>
> the EDT. VTK calls to non-rendering objects I do in other threads<br>
> sometimes. Are you saying that if a VTK object is created in a given<br>
> thread, it must also be disposed of in that same thread? I definitely use<br>
> one thread to create vtkObjects and then other threads access them in a<br>
> thread safe manner. I thought this was OK.<br>
><br>
> On Tue, Mar 29, 2011 at 11:41 AM, Sebastien Jourdain<br>
> <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>><br>
>> Do you call that method ? This will remove all the VTK object that<br>
>> have been created through Java regardless if you are still using them<br>
>> or not.<br>
>><br>
>> > vtkGlobalJavaHash.DeleteAll();<br>
>><br>
>> Have you got an idea in which thread you are using the VTK objects ?<br>
>> If not, you do have a problem. VTK is not thread safe therefore you<br>
>> should make sure (like swing) that any VTK code get executed in the<br>
>> EDT. (creation, setting, update...)<br>
>><br>
>> Seb<br>
>><br>
>> PS: On the other hand, if you know what you are doing, you can use VTK<br>
>> in a multi-threaded environment with sometime some synchronization<br>
>> with the EDT.<br>
>><br>
>> On Tue, Mar 29, 2011 at 2:26 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> wrote:<br>
>> > OK, I'm still getting a lot of JNI errors when I run the<br>
>> > vtkGarbageCollector<br>
>> > that look like the following. Do you have any idea what's going on<br>
>> > here?<br>
>> > Here is the code that it is being called from<br>
>> > private static class MyVTKClean implements Runnable {<br>
>> > private boolean runVTKDelete;<br>
>> > private int numDelete;<br>
>> > public MyVTKClean(boolean runVTKDelete) {<br>
>> > this.runVTKDelete = runVTKDelete;<br>
>> > }<br>
>> > public synchronized void run() {<br>
>> > if (runVTKDelete)<br>
>> > numDelete = vtkGlobalJavaHash.DeleteAll();<br>
>> > else<br>
>> > numDelete = vtkGlobalJavaHash.GC();<br>
>> > }<br>
>> > public int getNumDelete() {<br>
>> > return numDelete;<br>
>> > }<br>
>> > }<br>
>> ><br>
>> > // I think the VTK clean up has to run<br>
>> > // on the EDT, so we'll do that here<br>
>> > public synchronized static void cleanSystem(boolean runVTKDelete) {<br>
>> > System.gc();<br>
>> > System.runFinalization();<br>
>> > MyVTKClean run = new MyVTKClean(runVTKDelete);<br>
>> > // I'm not sure what to do here, it crashes sometimes<br>
>> > // I honestly think we're going to have to go through the<br>
>> > program<br>
>> > // and just manually manage all our own memory.<br>
>> > SwingUtilities.invokeLater(run);<br>
>> > }<br>
>> > Here is a reproduction of the JNI VTK error.<br>
>> > #<br>
>> > # A fatal error has been detected by the Java Runtime Environment:<br>
>> > #<br>
>> > # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000020001ba29400,<br>
>> > pid=5420, tid=5264<br>
>> > #<br>
>> > # JRE version: 6.0_24-b07<br>
>> > # Java VM: Java HotSpot(TM) 64-Bit Server VM (19.1-b02 mixed mode<br>
>> > windows-amd64 compressed oops)<br>
>> > # Problematic frame:<br>
>> > # C 0x000020001ba29400<br>
>> > #<br>
>> > # If you would like to submit a bug report, please visit:<br>
>> > # <a href="http://java.sun.com/webapps/bugreport/crash.jsp" target="_blank">http://java.sun.com/webapps/bugreport/crash.jsp</a><br>
>> > # The crash happened outside the Java Virtual Machine in native code.<br>
>> > # See problematic frame for where to report the bug.<br>
>> > #<br>
>> > --------------- T H R E A D ---------------<br>
>> > Current thread (0x0000000007e4c000): JavaThread "AWT-EventQueue-0"<br>
>> > [_thread_in_native, id=5264,<br>
>> > stack(0x0000000008ee0000,0x0000000008fe0000)]<br>
>> > siginfo: ExceptionCode=0xc0000005,<br>
>> > ExceptionInformation=0x0000000000000008<br>
>> > 0x000020001ba29400<br>
>> > Registers:<br>
>> > RAX=0x000007fee9a7ffff, RBX=0x0000000007caf0c8, RCX=0x0000000007c00d90,<br>
>> > RDX=0x0000000008fde720<br>
>> > RSP=0x0000000008fde608, RBP=0x0000000007caf0d8, RSI=0x000000005976e7a0,<br>
>> > RDI=0x0000000007cafff0<br>
>> > R8=0x0000000000000000, R9=0x0000000000000009, R10=0x0000000006ba18b0,<br>
>> > R11=0x0000000007cafff0<br>
>> > R12=0x0000000007caf0d8, R13=0x0000000008fde720, R14=0x0000000007bdd2d0,<br>
>> > R15=0x0000000000000002<br>
>> > RIP=0x000020001ba29400, EFLAGS=0x0000000000010246<br>
>> > Register to memory mapping:<br>
>> > RAX=0x000007fee9a7ffff<br>
>> > 0x000007fee9a7ffff is pointing to unknown location<br>
>> > RBX=0x0000000007caf0c8<br>
>> > 0x0000000007caf0c8 is pointing to unknown location<br>
>> > RCX=0x0000000007c00d90<br>
>> > 0x0000000007c00d90 is pointing to unknown location<br>
>> > RDX=0x0000000008fde720<br>
>> > 0x0000000008fde720 is pointing into the stack for thread:<br>
>> > 0x0000000007e4c000<br>
>> > "AWT-EventQueue-0" prio=6 tid=0x0000000007e4c000 nid=0x1490 runnable<br>
>> > [0x0000000008fde000]<br>
>> > java.lang.Thread.State: RUNNABLE<br>
>> > RSP=0x0000000008fde608<br>
>> > 0x0000000008fde608 is pointing into the stack for thread:<br>
>> > 0x0000000007e4c000<br>
>> > "AWT-EventQueue-0" prio=6 tid=0x0000000007e4c000 nid=0x1490 runnable<br>
>> > [0x0000000008fde000]<br>
>> > java.lang.Thread.State: RUNNABLE<br>
>> > RBP=0x0000000007caf0d8<br>
>> > 0x0000000007caf0d8 is pointing to unknown location<br>
>> > RSI=0x000000005976e7a0<br>
>> > 0x000000005976e7a0 is pointing to unknown location<br>
>> > RDI=0x0000000007cafff0<br>
>> > 0x0000000007cafff0 is pointing to unknown location<br>
>> > R8 =0x0000000000000000<br>
>> > 0x0000000000000000 is pointing to unknown location<br>
>> > R9 =0x0000000000000009<br>
>> > 0x0000000000000009 is pointing to unknown location<br>
>> > R10=0x0000000006ba18b0<br>
>> > 0x0000000006ba18b0 is pointing to unknown location<br>
>> > R11=0x0000000007cafff0<br>
>> > 0x0000000007cafff0 is pointing to unknown location<br>
>> > R12=0x0000000007caf0d8<br>
>> > 0x0000000007caf0d8 is pointing to unknown location<br>
>> > R13=0x0000000008fde720<br>
>> > 0x0000000008fde720 is pointing into the stack for thread:<br>
>> > 0x0000000007e4c000<br>
>> > "AWT-EventQueue-0" prio=6 tid=0x0000000007e4c000 nid=0x1490 runnable<br>
>> > [0x0000000008fde000]<br>
>> > java.lang.Thread.State: RUNNABLE<br>
>> > R14=0x0000000007bdd2d0<br>
>> > 0x0000000007bdd2d0 is pointing to unknown location<br>
>> > R15=0x0000000000000002<br>
>> > 0x0000000000000002 is pointing to unknown location<br>
>> ><br>
>> > Top of Stack: (sp=0x0000000008fde608)<br>
>> > 0x0000000008fde608: 000007fee995d99b 0000000007caf0c0<br>
>> > 0x0000000008fde618: 0000000007caf0c0 000000005976e7a0<br>
>> > 0x0000000008fde628: 0000000000000000 000000005976e7a0<br>
>> > 0x0000000008fde638: 0000000007caf0b0 000000005976e7a0<br>
>> > 0x0000000008fde648: 0000000007caf0b0 0000000000000000<br>
>> > 0x0000000008fde658: 0000000008fde720 00000000bb8bd928<br>
>> > 0x0000000008fde668: 0000000000000000 0000000000000000<br>
>> > 0x0000000008fde678: 000007fee9960ab3 0000000008fde720<br>
>> > 0x0000000008fde688: 0000000007cafff0 0000000000000000<br>
>> > 0x0000000008fde698: 0000000000000000 0000000007e4c000<br>
>> > 0x0000000008fde6a8: 0000000008fde950 00000000bb8bd928<br>
>> > 0x0000000008fde6b8: 0000000000000000 0000000058511290<br>
>> > 0x0000000008fde6c8: 000007fee9960e6f 0000000058511290<br>
>> > 0x0000000008fde6d8: 0000000008fde928 00000000bca11e68<br>
>> > 0x0000000008fde6e8: 0000000002407f03 00000000c0c06c78<br>
>> > 0x0000000008fde6f8: 0000000008fde700 000000006df196a0<br>
>> > Instructions: (pc=0x000020001ba29400)<br>
>> > 0x000020001ba293f0:<br>
>> > [error occurred during error reporting (printing registers, top of<br>
>> > stack,<br>
>> > instructions near pc), id 0xc0000005]<br>
>> > Stack: [0x0000000008ee0000,0x0000000008fe0000], sp=0x0000000008fde608,<br>
>> > free space=1017k<br>
>> > Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,<br>
>> > C=native<br>
>> > code)<br>
>> > C 0x000020001ba29400<br>
>> > Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)<br>
>> > j vtk.vtkObjectBase.VTKDeleteReference(J)V+0<br>
>> > j vtk.vtkGlobalJavaHash.GC()I+73<br>
>> > j prefs.ENV$MyVTKClean.run()V+18<br>
>> > j java.awt.event.InvocationEvent.dispatch()V+47<br>
>> > j<br>
>> ><br>
>> > java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21<br>
>> > j<br>
>> ><br>
>> > java.awt.EventQueue.access$000(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3<br>
>> > j java.awt.EventQueue$1.run()Ljava/lang/Void;+12<br>
>> > j java.awt.EventQueue$1.run()Ljava/lang/Object;+1<br>
>> > v ~StubRoutines::call_stub<br>
>> > j<br>
>> ><br>
>> > java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0<br>
>> > j<br>
>> ><br>
>> > java.security.AccessControlContext$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28<br>
>> > j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46<br>
>> > j java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204<br>
>> > j<br>
>> ><br>
>> > java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30<br>
>> > j<br>
>> ><br>
>> > java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11<br>
>> > j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4<br>
>> > j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3<br>
>> > j java.awt.EventDispatchThread.run()V+9<br>
>> > v ~StubRoutines::call_stub<br>
>> > --------------- P R O C E S S ---------------<br>
>> > Java Threads: ( => current thread )<br>
>> > 0x0000000009609800 JavaThread "Timer-4" [_thread_in_native, id=5844,<br>
>> > stack(0x0000000051110000,0x0000000051210000)]<br>
>> > 0x000000000960c800 JavaThread "SwingWorker-pool-4-thread-1" daemon<br>
>> > [_thread_blocked, id=6424, stack(0x0000000053a00000,0x0000000053b00000)]<br>
>> > 0x000000000960b000 JavaThread "pool-1-thread-1" [_thread_blocked,<br>
>> > id=3136,<br>
>> > stack(0x000000000bd50000,0x000000000be50000)]<br>
>> > 0x0000000009608800 JavaThread "DestroyJavaVM" [_thread_blocked,<br>
>> > id=5108,<br>
>> > stack(0x00000000022e0000,0x00000000023e0000)]<br>
>> > 0x0000000009608000 JavaThread "TimerQueue" daemon [_thread_blocked,<br>
>> > id=6340, stack(0x000000000a8f0000,0x000000000a9f0000)]<br>
>> > 0x0000000007f2c000 JavaThread "Timer-2" [_thread_blocked, id=6600,<br>
>> > stack(0x00000000090e0000,0x00000000091e0000)]<br>
>> > 0x0000000007f2b000 JavaThread "Timer-1" [_thread_blocked, id=3288,<br>
>> > stack(0x0000000008c40000,0x0000000008d40000)]<br>
>> > 0x00000000061b0000 JavaThread "ssh-connection 1" daemon<br>
>> > [_thread_blocked,<br>
>> > id=6048, stack(0x00000000086f0000,0x00000000087f0000)]<br>
>> > 0x00000000080d0000 JavaThread "Transport protocol 1" daemon<br>
>> > [_thread_in_native, id=4200,<br>
>> > stack(0x000000000a730000,0x000000000a830000)]<br>
>> > 0x0000000007e4c800 JavaThread "Timer-0" [_thread_blocked, id=2128,<br>
>> > stack(0x0000000008fe0000,0x00000000090e0000)]<br>
>> > =>0x0000000007e4c000 JavaThread "AWT-EventQueue-0" [_thread_in_native,<br>
>> > id=5264, stack(0x0000000008ee0000,0x0000000008fe0000)]<br>
>> > 0x000000000625f800 JavaThread "AWT-Windows" daemon [_thread_in_native,<br>
>> > id=6700, stack(0x00000000085f0000,0x00000000086f0000)]<br>
>> > 0x000000000625e800 JavaThread "AWT-Shutdown" [_thread_blocked,<br>
>> > id=2500,<br>
>> > stack(0x00000000084f0000,0x00000000085f0000)]<br>
>> > 0x000000000611b000 JavaThread "Java2D Disposer" daemon<br>
>> > [_thread_blocked,<br>
>> > id=4280, stack(0x00000000083f0000,0x00000000084f0000)]<br>
>> > 0x00000000060c7800 JavaThread "Low Memory Detector" daemon<br>
>> > [_thread_blocked, id=4272, stack(0x0000000006980000,0x0000000006a80000)]<br>
>> > 0x00000000060c7000 JavaThread "CompilerThread1" daemon<br>
>> > [_thread_blocked,<br>
>> > id=2744, stack(0x0000000006880000,0x0000000006980000)]<br>
>> > 0x00000000060c3000 JavaThread "CompilerThread0" daemon<br>
>> > [_thread_blocked,<br>
>> > id=5308, stack(0x0000000006780000,0x0000000006880000)]<br>
>> > 0x00000000060ae800 JavaThread "JDWP Command Reader" daemon<br>
>> > [_thread_in_native, id=5568,<br>
>> > stack(0x0000000006680000,0x0000000006780000)]<br>
>> > 0x00000000060ab000 JavaThread "JDWP Event Helper Thread" daemon<br>
>> > [_thread_blocked, id=6736, stack(0x0000000006580000,0x0000000006680000)]<br>
>> > 0x00000000060a5000 JavaThread "JDWP Transport Listener: dt_shmem"<br>
>> > daemon<br>
>> > [_thread_blocked, id=1744, stack(0x0000000006480000,0x0000000006580000)]<br>
>> > 0x00000000003e6800 JavaThread "Attach Listener" daemon<br>
>> > [_thread_blocked,<br>
>> > id=6416, stack(0x0000000006360000,0x0000000006460000)]<br>
>> > 0x00000000060a0800 JavaThread "Signal Dispatcher" daemon<br>
>> > [_thread_blocked,<br>
>> > id=6608, stack(0x0000000006260000,0x0000000006360000)]<br>
>> > 0x00000000003cd800 JavaThread "Finalizer" daemon [_thread_blocked,<br>
>> > id=5328, stack(0x0000000005f60000,0x0000000006060000)]<br>
>> > 0x00000000003ca000 JavaThread "Reference Handler" daemon<br>
>> > [_thread_blocked,<br>
>> > id=6568, stack(0x0000000005e60000,0x0000000005f60000)]<br>
>> > Other Threads:<br>
>> > 0x00000000003c3800 VMThread [stack:<br>
>> > 0x0000000005d60000,0x0000000005e60000]<br>
>> > [id=6624]<br>
>> > 0x00000000060cd800 WatcherThread [stack:<br>
>> > 0x0000000006a80000,0x0000000006b80000] [id=968]<br>
>> > VM state:not at safepoint (normal execution)<br>
>> > VM Mutex/Monitor currently owned by a thread: None<br>
>> > Heap<br>
>> > PSYoungGen total 18944K, used 491K [0x00000000ead60000,<br>
>> > 0x00000000ec280000, 0x0000000100000000)<br>
>> > eden space 16256K, 3% used<br>
>> > [0x00000000ead60000,0x00000000eaddae10,0x00000000ebd40000)<br>
>> > from space 2688K, 0% used<br>
>> > [0x00000000ebfe0000,0x00000000ebfe0000,0x00000000ec280000)<br>
>> > to space 2688K, 0% used<br>
>> > [0x00000000ebd40000,0x00000000ebd40000,0x00000000ebfe0000)<br>
>> > PSOldGen total 43392K, used 10564K [0x00000000c0800000,<br>
>> > 0x00000000c3260000, 0x00000000ead60000)<br>
>> > object space 43392K, 24% used<br>
>> > [0x00000000c0800000,0x00000000c1251378,0x00000000c3260000)<br>
>> > PSPermGen total 23616K, used 23499K [0x00000000bb600000,<br>
>> > 0x00000000bcd10000, 0x00000000c0800000)<br>
>> > object space 23616K, 99% used<br>
>> > [0x00000000bb600000,0x00000000bccf2d70,0x00000000bcd10000)<br>
>> > Dynamic libraries:<br>
>> > 0x0000000000400000 - 0x000000000042e000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\java.exe<br>
>> > 0x00000000775d0000 - 0x0000000077779000 C:\Windows\SYSTEM32\ntdll.dll<br>
>> > 0x00000000773b0000 - 0x00000000774cf000 C:\Windows\system32\kernel32.dll<br>
>> > 0x000007fefcac0000 - 0x000007fefcb2b000<br>
>> > C:\Windows\system32\KERNELBASE.dll<br>
>> > 0x000007fefe6b0000 - 0x000007fefe78b000 C:\Windows\system32\ADVAPI32.dll<br>
>> > 0x000007fefce70000 - 0x000007fefcf0f000 C:\Windows\system32\msvcrt.dll<br>
>> > 0x000007fefece0000 - 0x000007fefecff000 C:\Windows\SYSTEM32\sechost.dll<br>
>> > 0x000007fefe090000 - 0x000007fefe1bd000 C:\Windows\system32\RPCRT4.dll<br>
>> > 0x000000006d890000 - 0x000000006df94000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\server\jvm.dll<br>
>> > 0x00000000774d0000 - 0x00000000775ca000 C:\Windows\system32\USER32.dll<br>
>> > 0x000007fefd290000 - 0x000007fefd2f7000 C:\Windows\system32\GDI32.dll<br>
>> > 0x000007fefd280000 - 0x000007fefd28e000 C:\Windows\system32\LPK.dll<br>
>> > 0x000007fefed00000 - 0x000007fefedc9000 C:\Windows\system32\USP10.dll<br>
>> > 0x000007fef9d90000 - 0x000007fef9dcb000 C:\Windows\system32\WINMM.dll<br>
>> > 0x000007fefe790000 - 0x000007fefe7be000 C:\Windows\system32\IMM32.DLL<br>
>> > 0x000007fefe390000 - 0x000007fefe499000 C:\Windows\system32\MSCTF.dll<br>
>> > 0x000000006d800000 - 0x000000006d80e000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\verify.dll<br>
>> > 0x000000006d450000 - 0x000000006d477000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\java.dll<br>
>> > 0x000000006d3b0000 - 0x000000006d3ba000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\hpi.dll<br>
>> > 0x00000000777a0000 - 0x00000000777a7000 C:\Windows\system32\PSAPI.DLL<br>
>> > 0x000000006d4c0000 - 0x000000006d4f4000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\jdwp.dll<br>
>> > 0x000000006d6d0000 - 0x000000006d6d8000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\npt.dll<br>
>> > 0x000000006d850000 - 0x000000006d862000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\zip.dll<br>
>> > 0x000000006d300000 - 0x000000006d30a000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\dt_shmem.dll<br>
>> > 0x000007fef1360000 - 0x000007fef13cb000<br>
>> > C:\Users\...\dist\64\vtkCommonJava.dll<br>
>> > 0x000007fee9900000 - 0x000007fee9b6f000<br>
>> > C:\Users\...\dist\64\vtkCommon.dll<br>
>> > 0x000007fef4bf0000 - 0x000007fef4c32000 C:\Users\...\dist\64\vtksys.dll<br>
>> > 0x000007fefd1d0000 - 0x000007fefd21d000 C:\Windows\system32\WS2_32.dll<br>
>> > 0x000007fefcde0000 - 0x000007fefcde8000 C:\Windows\system32\NSI.dll<br>
>> > 0x0000000072850000 - 0x00000000728ed000<br>
>> ><br>
>> > C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c\MSVCR90.dll<br>
>> > 0x0000000074590000 - 0x0000000074663000<br>
>> ><br>
>> > C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c\MSVCP90.dll<br>
>> > 0x000007fef0410000 - 0x000007fef0419000 C:\Windows\system32\WSOCK32.dll<br>
>> > 0x000007feedb20000 - 0x000007feedbbc000<br>
>> > C:\Users\...\dist\64\vtkFilteringJava.dll<br>
>> > 0x000007fee95e0000 - 0x000007fee98f2000<br>
>> > C:\Users\...\dist\64\vtkFiltering.dll<br>
>> > 0x000007fef9f90000 - 0x000007fef9f9f000<br>
>> > C:\Users\...\dist\64\vtkGenericFilteringJava.dll<br>
>> > 0x000007fef1320000 - 0x000007fef1356000<br>
>> > C:\Users\...\dist\64\vtkGenericFiltering.dll<br>
>> > 0x000007fee8fe0000 - 0x000007fee95d6000<br>
>> > C:\Users\...\dist\64\vtkGraphics.dll<br>
>> > 0x000007fef0a60000 - 0x000007fef0a91000<br>
>> > C:\Users\...\dist\64\vtkverdict.dll<br>
>> > 0x000007feef720000 - 0x000007feef7b2000<br>
>> > C:\Users\...\dist\64\vtkGraphicsJava.dll<br>
>> > 0x000007fef1290000 - 0x000007fef12df000<br>
>> > C:\Users\...\dist\64\vtkHybridJava.dll<br>
>> > 0x000007fee8d30000 - 0x000007fee8fd1000<br>
>> > C:\Users\...\dist\64\vtkHybrid.dll<br>
>> > 0x000007fee88d0000 - 0x000007fee8d22000<br>
>> > C:\Users\...\dist\64\vtkRendering.dll<br>
>> > 0x000007fefe4a0000 - 0x000007fefe6a3000 C:\Windows\system32\ole32.dll<br>
>> > 0x000007fefe7c0000 - 0x000007fefe897000 C:\Windows\system32\OLEAUT32.dll<br>
>> > 0x000007fee8600000 - 0x000007fee88ce000<br>
>> > C:\Users\...\dist\64\vtkImaging.dll<br>
>> > 0x000007fee8150000 - 0x000007fee85f9000 C:\Users\...\dist\64\vtkIO.dll<br>
>> > 0x000007fef4bc0000 - 0x000007fef4be3000<br>
>> > C:\Users\...\dist\64\vtkDICOMParser.dll<br>
>> > 0x000007feed060000 - 0x000007feed110000<br>
>> > C:\Users\...\dist\64\vtkNetCDF.dll<br>
>> > 0x000007fef9f70000 - 0x000007fef9f8d000<br>
>> > C:\Users\...\dist\64\vtkNetCDF_cxx.dll<br>
>> > 0x000007feed560000 - 0x000007feed5f3000<br>
>> > C:\Users\...\dist\64\vtkmetaio.dll<br>
>> > 0x000007fef0a40000 - 0x000007fef0a55000 C:\Users\...\dist\64\vtkzlib.dll<br>
>> > 0x000007fef0a10000 - 0x000007fef0a33000 C:\Users\...\dist\64\vtkpng.dll<br>
>> > 0x000007feef6b0000 - 0x000007feef6d7000 C:\Users\...\dist\64\vtkjpeg.dll<br>
>> > 0x000007feee410000 - 0x000007feee461000 C:\Users\...\dist\64\vtktiff.dll<br>
>> > 0x000007feee3e0000 - 0x000007feee403000<br>
>> > C:\Users\...\dist\64\vtkexpat.dll<br>
>> > 0x000007fef0580000 - 0x000007fef059f000 C:\Windows\system32\AVIFIL32.dll<br>
>> > 0x000007fef9d20000 - 0x000007fef9d38000 C:\Windows\system32\MSACM32.dll<br>
>> > 0x000007feee350000 - 0x000007feee379000 C:\Windows\system32\MSVFW32.dll<br>
>> > 0x000007fefd300000 - 0x000007fefe088000 C:\Windows\system32\SHELL32.dll<br>
>> > 0x000007fefcdf0000 - 0x000007fefce61000 C:\Windows\system32\SHLWAPI.dll<br>
>> > 0x000007fefb4e0000 - 0x000007fefb6d4000<br>
>> ><br>
>> > C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll<br>
>> > 0x000007fef9eb0000 - 0x000007fef9ebf000 C:\Users\...\dist\64\vtkftgl.dll<br>
>> > 0x000007fee9cc0000 - 0x000007fee9ddd000 C:\Windows\system32\OPENGL32.dll<br>
>> > 0x000007feedaf0000 - 0x000007feedb1d000 C:\Windows\system32\GLU32.dll<br>
>> > 0x000007fee9bc0000 - 0x000007fee9cb1000 C:\Windows\system32\DDRAW.dll<br>
>> > 0x000007fef9420000 - 0x000007fef9428000 C:\Windows\system32\DCIMAN32.dll<br>
>> > 0x000007fefe8a0000 - 0x000007fefea77000 C:\Windows\system32\SETUPAPI.dll<br>
>> > 0x000007fefcb30000 - 0x000007fefcb66000 C:\Windows\system32\CFGMGR32.dll<br>
>> > 0x000007fefcdc0000 - 0x000007fefcdda000 C:\Windows\system32\DEVOBJ.dll<br>
>> > 0x000007fefaed0000 - 0x000007fefaee8000 C:\Windows\system32\dwmapi.dll<br>
>> > 0x000007feed4e0000 - 0x000007feed554000<br>
>> > C:\Users\...\dist\64\vtkfreetype.dll<br>
>> > 0x000007fee7f50000 - 0x000007fee814f000 C:\Windows\system32\d3d9.dll<br>
>> > 0x000007fefb9d0000 - 0x000007fefb9dc000 C:\Windows\system32\VERSION.dll<br>
>> > 0x000007fef8870000 - 0x000007fef8877000 C:\Windows\system32\d3d8thk.dll<br>
>> > 0x000007feedaa0000 - 0x000007feedae5000<br>
>> > C:\Users\...\dist\64\vtkexoIIc.dll<br>
>> > 0x000007feefc40000 - 0x000007feefc57000 C:\Windows\system32\AVICAP32.dll<br>
>> > 0x000007feec740000 - 0x000007feec7c1000<br>
>> > C:\Users\...\dist\64\vtkRenderingJava.dll<br>
>> > 0x000000006d490000 - 0x000000006d497000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\jawt.dll<br>
>> > 0x000000006d0a0000 - 0x000000006d263000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\awt.dll<br>
>> > 0x000007fef8bc0000 - 0x000007fef8c31000 C:\Windows\system32\WINSPOOL.DRV<br>
>> > 0x000007feed010000 - 0x000007feed05e000<br>
>> > C:\Users\...\dist\64\vtkIOJava.dll<br>
>> > 0x000007feec6f0000 - 0x000007feec732000<br>
>> > C:\Users\...\dist\64\vtkImagingJava.dll<br>
>> > 0x000007feed4b0000 - 0x000007feed4d3000<br>
>> > C:\Users\...\dist\64\vtkVolumeRenderingJava.dll<br>
>> > 0x000007fee7ad0000 - 0x000007fee7f48000<br>
>> > C:\Users\...\dist\64\vtkVolumeRendering.dll<br>
>> > 0x000007fee7a70000 - 0x000007fee7ac2000<br>
>> > C:\Users\...\dist\64\vtkWidgetsJava.dll<br>
>> > 0x000007fee78e0000 - 0x000007fee7a6e000<br>
>> > C:\Users\...\dist\64\vtkWidgets.dll<br>
>> > 0x000007fee9b90000 - 0x000007fee9bb8000<br>
>> > C:\Users\...\dist\64\vtkgdcmJava.dll<br>
>> > 0x000007fee7820000 - 0x000007fee78df000 C:\Users\...\dist\64\vtkgdcm.dll<br>
>> > 0x000007fee7710000 - 0x000007fee781e000<br>
>> > C:\Users\...\dist\64\gdcmMSFF.dll<br>
>> > 0x000007fee76e0000 - 0x000007fee7710000 C:\Users\...\dist\64\gdcmIOD.dll<br>
>> > 0x000007fee7660000 - 0x000007fee76d5000<br>
>> > C:\Users\...\dist\64\gdcmDSED.dll<br>
>> > 0x000007feef470000 - 0x000007feef484000<br>
>> > C:\Users\...\dist\64\gdcmCommon.dll<br>
>> > 0x000007feec230000 - 0x000007feec246000<br>
>> > C:\Users\...\dist\64\gdcmzlib.dll<br>
>> > 0x000007fee7630000 - 0x000007fee7653000<br>
>> > C:\Users\...\dist\64\gdcmexpat.dll<br>
>> > 0x000007fee74d0000 - 0x000007fee762b000<br>
>> > C:\Users\...\dist\64\gdcmDICT.dll<br>
>> > 0x000007fee74a0000 - 0x000007fee74cb000<br>
>> > C:\Users\...\dist\64\gdcmjpeg8.dll<br>
>> > 0x000007fee7470000 - 0x000007fee749b000<br>
>> > C:\Users\...\dist\64\gdcmjpeg12.dll<br>
>> > 0x000007fee7440000 - 0x000007fee746c000<br>
>> > C:\Users\...\dist\64\gdcmjpeg16.dll<br>
>> > 0x000007fee7410000 - 0x000007fee7437000<br>
>> > C:\Users\...\dist\64\gdcmopenjpeg.dll<br>
>> > 0x000007fee73d0000 - 0x000007fee7409000<br>
>> > C:\Users\...\dist\64\gdcmcharls.dll<br>
>> > 0x000007fefb300000 - 0x000007fefb356000 C:\Windows\system32\uxtheme.dll<br>
>> > 0x000007fefc940000 - 0x000007fefc94f000<br>
>> > C:\Windows\system32\CRYPTBASE.dll<br>
>> > 0x000000006d340000 - 0x000000006d3a6000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\fontmanager.dll<br>
>> > 0x000000006d6a0000 - 0x000000006d6b7000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\net.dll<br>
>> > 0x000007fefc240000 - 0x000007fefc295000 C:\Windows\system32\mswsock.dll<br>
>> > 0x000007fefc230000 - 0x000007fefc237000 C:\Windows\System32\wship6.dll<br>
>> > 0x000000006d6c0000 - 0x000000006d6cb000 C:\Program<br>
>> > Files\Java\jdk1.6.0_24\jre\bin\nio.dll<br>
>> > 0x000007fee7360000 - 0x000007fee73cf000 C:\Users\...\dist\64\gdcmjni.dll<br>
>> > 0x000007fefc2e0000 - 0x000007fefc2f7000 C:\Windows\system32\CRYPTSP.dll<br>
>> > 0x000007fefbfa0000 - 0x000007fefbfe7000 C:\Windows\system32\rsaenh.dll<br>
>> > 0x000007fefbd50000 - 0x000007fefbd6e000 C:\Windows\system32\USERENV.dll<br>
>> > 0x000007fefca10000 - 0x000007fefca1f000 C:\Windows\system32\profapi.dll<br>
>> > 0x000007fefa4e0000 - 0x000007fefa4f5000 C:\Windows\system32\NLAapi.dll<br>
>> > 0x000007fef89e0000 - 0x000007fef89f5000 C:\Windows\system32\napinsp.dll<br>
>> > 0x000007fef89c0000 - 0x000007fef89d9000 C:\Windows\system32\pnrpnsp.dll<br>
>> > 0x000007fef89b0000 - 0x000007fef89c0000 C:\Windows\system32\wshbth.dll<br>
>> > 0x000007fefc0c0000 - 0x000007fefc11b000 C:\Windows\system32\DNSAPI.dll<br>
>> > 0x000007fef89a0000 - 0x000007fef89ab000 C:\Windows\System32\winrnr.dll<br>
>> > 0x000007fefbc40000 - 0x000007fefbc47000 C:\Windows\System32\wshtcpip.dll<br>
>> > 0x000007fef9f30000 - 0x000007fef9f57000 C:\Windows\system32\IPHLPAPI.DLL<br>
>> > 0x000007fef9f60000 - 0x000007fef9f6b000 C:\Windows\system32\WINNSI.DLL<br>
>> > 0x000007fef8990000 - 0x000007fef8998000 C:\Windows\system32\rasadhlp.dll<br>
>> > 0x000007fef9ec0000 - 0x000007fef9f13000 C:\Windows\System32\fwpuclnt.dll<br>
>> > 0x000007fefcd80000 - 0x000007fefcdba000 C:\Windows\system32\WINTRUST.dll<br>
>> > 0x000007fefcb70000 - 0x000007fefccd7000 C:\Windows\system32\CRYPT32.dll<br>
>> > 0x000007fefcab0000 - 0x000007fefcabf000 C:\Windows\system32\MSASN1.dll<br>
>> > 0x0000000069500000 - 0x000000006a195000 C:\Windows\system32\nvoglv64.DLL<br>
>> > VM Arguments:<br>
>> > jvm_args: -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug<br>
>> > -Dfile.encoding=UTF-8 -Dsun.java2d.ddoffscreen=false<br>
>> > -Dsun.java2d.gdiblit=false<br>
>> > java_command: Application yes no<br>
>> > Launcher Type: SUN_STANDARD<br>
>> > Environment Variables:<br>
>> > JAVA_HOME=C:\Program Files\Java\jdk1.6.0_18<br>
>> > PATH=C:\Program Files (x86)\MiKTeX<br>
>> ><br>
>> > 2.8\miktex\bin;C:\Ruby19\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\strawberry\c\bin;C:\strawberry\perl\bin;c:\Program<br>
>> > Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program<br>
>> > Files\MySQL\MySQL<br>
>> > Server<br>
>> ><br>
>> > 5.1\bin;C:\Users\jmorra\Downloads\dcm4che\dcm4che-2.0.21\bin;C:\Users\...\dist\64;C:\Program<br>
>> > Files (x86)\Calibre2\;C:\Program Files (x86)\SSH Communications<br>
>> > Security\SSH<br>
>> > Secure Shell<br>
>> > USERNAME=jmorra<br>
>> > OS=Windows_NT<br>
>> > PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel<br>
>> ><br>
>> ><br>
>> > --------------- S Y S T E M ---------------<br>
>> > OS: Windows 7 Build 7601 Service Pack 1<br>
>> > CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23<br>
>> > stepping<br>
>> > 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1<br>
>> > Memory: 4k page, physical 4158344k(884196k free), swap 8314844k(3659748k<br>
>> > free)<br>
>> > vm_info: Java HotSpot(TM) 64-Bit Server VM (19.1-b02) for windows-amd64<br>
>> > JRE<br>
>> > (1.6.0_24-b07), built on Feb 2 2011 16:25:45 by "java_re" with MS VC++<br>
>> > 8.0<br>
>> > (VS2005)<br>
>> > time: Tue Mar 29 11:21:13 2011<br>
>> > elapsed time: 50 seconds<br>
>> ><br>
>> > On Tue, Mar 29, 2011 at 8:27 AM, Sebastien Jourdain<br>
>> > <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>> >><br>
>> >> As I said, since a double[] is not a vtkObject, your are good to go<br>
>> >> with image.GetSpacing(), and there is no arm in that.<br>
>> >> It is not that it make java difficult to use, it will induce more<br>
>> >> lines. But don't make me wrong this problem occurs ONLY when you bind<br>
>> >> two vtkObject together whithout any Java instance holding the<br>
>> >> reference in between.<br>
>> >><br>
>> >> BAD => a.SetX(b.GetY());<br>
>> >><br>
>> >> But you can do<br>
>> >><br>
>> >> z = a.GetX().GetY().GetZ();<br>
>> >> b.SetZ(z);<br>
>> >><br>
>> >> or that too<br>
>> >><br>
>> >> b.SetZ(z = a.GetX().GetY().GetZ());<br>
>> >><br>
>> >> Seb<br>
>> >><br>
>> >> On Tue, Mar 29, 2011 at 11:10 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Thanks for your help. For number 3, image.GetSpacing() is a VTK<br>
>> >> > call,<br>
>> >> > however it returns a java double[], so I thought that it was OK. All<br>
>> >> > these<br>
>> >> > memory restrictions in Java make it very difficult to use, is there<br>
>> >> > any<br>
>> >> > plans to improve the usage of VTK in Java?<br>
>> >> > Thanks again!<br>
>> >> ><br>
>> >> > On Tue, Mar 29, 2011 at 5:26 AM, Sebastien Jourdain<br>
>> >> > <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>> wrote:<br>
>> >> >><br>
>> >> >> Hi Jonathan,<br>
>> >> >><br>
>> >> >> I directly reply on the context of your mail,<br>
>> >> >><br>
>> >> >><br>
>> >> >> On Tue, Mar 29, 2011 at 2:33 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > Since I'm using vtkJavaGarbageCollector I'm already using<br>
>> >> >> > vtkGlobalJavaHash.GC();. The main questions that I currently<br>
>> >> >> > still<br>
>> >> >> > need<br>
>> >> >> > answered are here<br>
>> >> >> > 1. should I have to call System.gc(); and<br>
>> >> >> > System.runFinalization();<br>
>> >> >> > frequently with VTK+Java? It appears the memory is managed better<br>
>> >> >> > when<br>
>> >> >> > calling these lines every time vtkGlobalJavaHash.GC() is called,<br>
>> >> >> > but<br>
>> >> >> > I<br>
>> >> >> > don't<br>
>> >> >> > know if this is necessary.<br>
>> >> >><br>
>> >> >> System.gc(); is the only one that you should really care about. But<br>
>> >> >> Java does not offer any guarantee if this method will do something<br>
>> >> >> or<br>
>> >> >> not. Moreover, the GC will stop all the thread to do its job. So it<br>
>> >> >> is basically up to you.<br>
>> >> >><br>
>> >> >> > 2. Is it ok to reuse Java variables? Such as<br>
>> >> >> > vtkImageData image = filter.GetOuput();<br>
>> >> >> > // Do Stuff<br>
>> >> >> > image = filter2.GetOuput();<br>
>> >> >><br>
>> >> >> yes<br>
>> >> >><br>
>> >> >> > 3. Is it OK to move around java objects without an intermediate<br>
>> >> >> > reference?<br>
>> >> >> > Such as<br>
>> >> >> > image1.SetOutputSpacing(image2.GetSpacing());<br>
>> >> >><br>
>> >> >> what do you mean by Java object ? for me as the Set/Get do have a<br>
>> >> >> capital letter, I would say they come from the VTK world and if they<br>
>> >> >> return a vtkObject, you should use an intermediate variable<br>
>> >> >> otherwise<br>
>> >> >> if it's an array of primary type, that is just fine.<br>
>> >> >><br>
>> >> >> > Sorry, forgot one more. Should I be calling<br>
>> >> >> > vtkGlobalJavaHash.GC()<br>
>> >> >> > from<br>
>> >> >> > the event dispatch thread?<br>
>> >> >> > I saw that as an option in vtkJavaGarbageCollector, and I'm not<br>
>> >> >> > sure<br>
>> >> >> > why<br>
>> >> >> > that's the case.<br>
>> >> >><br>
>> >> >> This totally depend on your VTK code, if you insure that all the<br>
>> >> >> call<br>
>> >> >> you are doing on the VTK layer is done through the EDT, then you<br>
>> >> >> should, otherwise you shouldn't. (This is a requirement if the data<br>
>> >> >> is<br>
>> >> >> shown in a renderer.)<br>
>> >> >><br>
>> >> >> Seb<br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>