<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi All,<br>
<br>
I'd like to request a change to vtkDataArray that will
extend/improve support for zero-copy with mixed language
programming. The change would add a method similar to SetArray that
takes a callback function which will be invoked when VTK is done
with data. This makes zero-copy ownership possible when free/delete
[] aren't the right choice for releasing the memory.<br>
<br>
The use case I'm targeting is zero-copy from Numpy ndarray data. In
my python-c++ glue code I can increment the PyArray's ref count
ensuring the data that VTK is given is not released while VTK needs
it. VTK invokes the callback which decrements the PyArray's ref
count when the data is no longer needed, which allows the data to
safely be released. Another use case that the callback would
addresses is support for zero-copy from FORTRAN where heap based
arrays are created with FORTRAN's "allocate" function and need to be
destroyed with its "deallocate" function. I investigated the use of
a functor rather than function pointer, however the "C" function
pointer will be the easiest to use in the mixed language setting.<br>
<br>
I'm interested to here peoples thoughts on this change. if there are
no objections to the concept/approach, would anyone be willing to
review?<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="http://review.source.kitware.com/#/c/14072/2">http://review.source.kitware.com/#/c/14072/2</a><br>
<br>
Thanks<br>
Burlen<br>
<br>
<br>
<br>
<br>
</body>
</html>