[Paraview] memory leak in writer
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Fri Jul 17 08:47:37 EDT 2009
Out of curiosity, why are you writing your own wrapper? ParaView 3.6
onwards supports writing time series for legacy vtk files.
Utkarsh
On Fri, Jul 17, 2009 at 7:53 AM, Natalie
Happenhofer<nataliehapp at hotmail.com> wrote:
> Hi!
> I´ve written a Wrapper for the Legacy VTK files writer, so that it writes a
> whole timeseries if I want it to. Lamentably, applying it, it needs more and
> more memory, so I am looking for a memory leak.
>
> Here is the bit of code I suspect:
>
> vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
> vtkDataObject* input = inInfo->Get(vtkDataObject::DATA_OBJECT());
>
> vtkSmartPointer<vtkDataObject> inputCopy;
> inputCopy.TakeReference(input->NewInstance());
> inputCopy->ShallowCopy(input);
>
> vtksys_ios::ostringstream fname;
> if (this->WriteAllTimeSteps)
> {
> vtkstd::string path =
> vtksys::SystemTools::GetFilenamePath(this->FileName);
> vtkstd::string fnamenoext =
> vtksys::SystemTools::GetFilenameWithoutLastExtension(this->FileName);
> vtkstd::string ext =
> vtksys::SystemTools::GetFilenameLastExtension(this->FileName);
> if((this -> CurrentTimeIndex) < 10) fname << path << "/" << fnamenoext
> << ".000" <<this->CurrentTimeIndex << ext;
> else if((this -> CurrentTimeIndex) < 100) fname << path << "/" <<
> fnamenoext << ".00" << this -> CurrentTimeIndex << ext;
> else if((this -> CurrentTimeIndex) < 1000) fname << path << "/" <<
> fnamenoext << ".0" << this -> CurrentTimeIndex << ext;
> else fname << path << "/" << fnamenoext << this -> CurrentTimeIndex <<
> ext;
> }
> else
> {
> fname << this->FileName;
> }
>
> //Here I call the usual VTK Writer and set the input
>
> vtkGenericDataObjectWriter* Writer = vtkGenericDataObjectWriter::New();
> Writer -> SetInput(inputCopy);
> Writer -> SetFileName(fname.str().c_str());
> if((this -> FileType) == 1) Writer -> SetFileTypeToASCII();
> else Writer -> SetFileTypeToBinary();
>
> Writer -> Update();
>
> if (this->WriteAllTimeSteps)
> {
> this->CurrentTimeIndex++;
> if (this->CurrentTimeIndex == this->NumberOfTimeSteps)
> {
> // Tell the pipeline to stop looping.
>
> request->Remove(vtkStreamingDemandDrivenPipeline::CONTINUE_EXECUTING());
> this->CurrentTimeIndex = 0;
> }
> }
>
> Writer -> Delete();
> return 1;
>
> Is there anything I forget to delete?
>
>
> thx for answers
> Natalie
>
>
>
> ________________________________
> Nuevo Internet Explorer 8 ¡Es Gratis y optimizado para MSN!
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
More information about the ParaView
mailing list