[Insight-users] problems with wrapITK in Java

Julia Smith julia.smith at ondiagnostics.com
Thu Jun 21 20:31:54 EDT 2007


I am encountering what appears to be a finalization issue with wrapITK in Java running on Red-Hat Linux x64.

The most pronounced version of this (set of) problems shows up when I run System.gc() after allocating a lot of images and filters, as I am doing when decomposing an image into a stack of slices. The images are small ~50x50x50 float sized pixels.

The reference count for an image produced by sliceFilter->GetOutput() is 1. Similarly the reference count for the filter is 1. If I run System.gc() right after creating and using these, the hot spot vm crashes reliably. If I hard set the filter and image reference counts to 2 the problem goes away. All this suggests something a bit touchy or overzealous with object finalization (JNI delete call).

I have freshly built against 3.2.0 (itk and cable-swig) and installed it and built any cpp code referencing itk against 3.2.0. The lib directory does contain 2.8.1 shared libs.

In a similar vein Binary and  Grayscale Dilate/Erode are extremely buggy, alternate instances work and then don't work. Things like this always smell of a stack whack or memory allocation bug.

These filters out right crashed in Java1.6.0, but cycling creation of these filters (if I run erode on the same image several times) on 1.6.0_01, produces a correct result 1 in 4 times. The other times the original image is shifted over by one pixel in x and in y, but not z.

I'd love to use the Morphological version of these as they run, but erode seems to be implemented in an incorrect/undesirable fashion.

Other instances of the above problem exhibits itself in small programs I have written which process > 150 image files. When the program hits about 140-150 images, the vm crashes, the mostly likely reason is that gc has run because the vm needs to reclaim memory.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070621/aac0fbb5/attachment-0001.html


More information about the Insight-users mailing list