[vtkusers] java memory

Mark Roden mmroden at gmail.com
Mon Apr 4 12:34:50 EDT 2011


Hi Sebastien,

On Mon, Apr 4, 2011 at 9:09 AM, Sebastien Jourdain
<sebastien.jourdain at kitware.com> wrote:

> With Qt you have to be very careful as well. The only difference is
> that you won't have to deal with in-between object to delete. But you
> will definitely have the multi-threading issue to manage when you
> delete vtk components.
>

How so?  From what you're describing, in order to use the Java
wrapping, all vtk calls have to be synced.  I can't know which calls
are allocating memory and which aren't (ie, 'GetScalars' is allocating
memory, but there's no explicit use of 'new'), so any time I call a
VTK object in Java, I could be allocating memory.  So, if I do
anything with VTK not on the EDT, then I'll end up with instabilities
if the EDT invokes the garbage collection.  If I don't invoke garbage
collection explicitly, I get leaks, and those leaks will quickly eat
through my memory if I have a, say, 512x512x128 volume of shorts with
8 same-size char masks on top of that.

But, if I'm in Qt/C++, then won't the allocations and deletions of
individual objects be distinct from one another?  I mean, if I have an
autosave thread, and the user deletes a mask while autosave is
happening, those sets of memory would be distinct from one another in
C++, and I should be fine (at least as regards to this problem),
because I don't have a single global memory allocation/deletion
location, right?

Or is my understanding of how VTK memory works incorrect?

Thanks,
Mark



More information about the vtkusers mailing list