[vtkusers] re-using allocated memory in image algorithm
David Gobbi
david.gobbi at gmail.com
Mon Aug 25 11:13:32 EDT 2014
Unless you're short on memory, ReleaseDataFlagOff() should always give
better performance. That's why it's the default ;)
- David
On Mon, Aug 25, 2014 at 8:42 AM, Maarten Beek <beekmaarten at yahoo.com> wrote:
> Hi all,
>
> Problem solved: De memory address of the scalars did change but because the
> ReleaseData flag was On...
>
> What would be best practice in a pipeline of about 6 image algorithms that
> all update during interaction: ReleaseData flag On or Off?
>
> (because that must have been the reason to put the flag to on a couple of
> months ago).
>
> Thanks - Maarten
>
>
> On Friday, August 22, 2014 4:31:14 PM, Maarten Beek via vtkusers
> <vtkusers at vtk.org> wrote:
>
>
> Thanks David for your reply.
>
> I'll check allocateScalars() and also make sure this is the function used by
> my algorithm...
> Printing the memory address is of course a good check.
>
> Thanks - Maarten
>
>
> On Friday, August 22, 2014 3:39:59 PM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>
> Hi Maarten,
>
> The VTK image algorithms automatically reuse their memory unless the
> data type or the size changes. For more info, look at the code for
> AllocateScalars in vtkImageData.cxx. Also, I recommend printing out
> the memory address after each Execute so that you can verify that it
> doesn't change.
>
> - David
>
>
> On Fri, Aug 22, 2014 at 8:04 AM, Maarten Beek via vtkusers
> <vtkusers at vtk.org> wrote:
>> Hi all,
>>
>> Is there a way to preserve the allocate memory of the put of an image
>> algorithm?
>>
>> Looking at the source code, I have the feeling that algorithms in vtk
>> allocate memory for their output each time ExecuteData() is called. I
>> created an image algorithm that updates almost continuously, but the image
>> size doesn't change. So once the output is created and memory is
>> allocated,
>> I could just keep using this output (just calling output->Modified() after
>> the data in the exiting memory is replaced). How would I do this?
>>
>> Thanks - Maarten
More information about the vtkusers
mailing list