[vtkusers] java memory

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Tue Mar 29 09:16:08 EDT 2011


those problems also apply to the python layer?

On Tue, Mar 29, 2011 at 8: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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-----------------------------------------------------------------
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-----------------------------------------------------------------



More information about the vtkusers mailing list