[vtkusers] SetJavaArray without memcpy

sumit shah shah at ucla.edu
Wed Sep 7 23:24:54 EDT 2005


Dear VTK users;

I have modified vtkWrapJava.c 's HandleDataArray's method with the  
following change:

    fprintf(fp,"  op->SetVoidArray((void*)tempArray0,length,0); 
\n",jfromtype);
   /*
   fprintf(fp,"  memcpy(op->GetVoidPointer(0), tempArray0,  
length*sizeof(%s));\n", type);
   fprintf(fp,"  env->Release%sArrayElements(id0,(j%s *)tempArray0,0); 
\n", jfromtype, jtype);
   */


I want to do this so I can do some image processing in Java without  
duplicating memory.  This works great, but I haven't quite figured  
out how or where to place the Release*ArrayElements.  Obviously I'll  
need to modify vtkParseJava.c and place some way.  Is it best to put  
the Release elements call in a finalize method or is there a more  
appropriate/logical place?

Thanks,
Sumit



More information about the vtkusers mailing list