[vtkusers] Why all this data releasing every Update?

Volpe, Christopher R (CRD) volpecr at crd.ge.com
Thu May 31 23:18:11 EDT 2001


I notice that every time an Update() is done, a source calls PrepareForNewData() on its output, which
in turn is mapped to an Initialize() call (except for image data, which decides it doesn't want to
free and re-allocate a huge chunk of data, so it overrides this). I'm wondering why this is done at
all. What is the rationale behind deallocating everything by default at each Update(), and what is
the justification for why this rationale doesn't apply to vtkImageData?

I ask now because I just came across an apparent bug in my own subclass of vtkDataObject, in which my
own Allocate() routine keeps track of the number of data arrays allocated in the vtkFieldData
component, and adds new data arrays as necessary each time Allocate() is called. Apparently, the fact
that my internal count of the number of existing data arrays differed from when the FieldData
actually had (zero, after PrepareForNewData()), didn't manifest itself until Berk's recent
improvements to the FieldData API. I just discovered all this data freeing in the process of tracking
down my bug.

I'm thinking of doing something along the lines of what vtkImageData does (i.e. subvert the data
freeing process). But rather than going through and Register()ing all the data arrays, calling
Initialize, and then adding them back into the field data, I'm thinking of just using an alternate
implementation of vtkDataObject's Initialize method, one which simply refrains from passing
Initialize() along to the FieldData. Would taking this approach cause pipeline problems anywhere? (If
not, then why release all the field data arrays in the first place?)

thanks,
Chris

> GE Corporate Research & Development 
> ___________________________________________________________________________________________________
> _______________________________________________
> 
Christopher R. Volpe
Computer Scientist
Visual Information Program
Bldg KW, Room C215
P.O. Box 8, Schenectady, NY 12301

(518) 387-7766, Dial Comm: 8*833-7766, Fax: (518) 387-6981
e-mail: volpecr at crd.ge.com    web: http://www.crd.ge.com/~volpecr









More information about the vtkusers mailing list