[vtkusers] java memory

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Mar 29 17:26:29 EDT 2011


If you have few place where you handle VTK object outside the EDT,
then you should use a lock (cf. java.util.concurrency) to make sure
that either the GC or a working thread is running but nether both. As
the GC is going to run in the EDT, you don't care with the code that
is already handle inside the EDT, just the code that create vtkObjects
inside another thread.

Although, depending on your code design, a call to .Delete() might be
fine if you know that you won't induce any concurrency between an EDT
that will try to render images (call update on each filter of the
pipeline) and another thread that is removing an object that is
referenced inside that pipeline.

Seb

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



More information about the vtkusers mailing list