memory cost pngafter load a vtkdataset,we use the renderWindow->Render(); but i found it will have a extra memory cost when the data is more than 100mb。 for example:a vtkdataset size is 500mb ,it'll cost from 500mb to 1.5G and then fall back to 500mb。 although the final memory cost is 500mb,but it will touch 1.5G memory cost . and i found There's no such thing in paraview. How does paraview do that?
the only solution I can found is to separate a dataset to vtkMultiBlockDataSet。but i havent test the effects to others(filter:clip slice streamline etc)。
#include <vtkActor.h>
#include <vtkCubeSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkActor.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderView.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#include <vtkPDataSetReader.h>
#include<vtkMultiBlockDataSet.h>
#include <vtkUnstructuredGrid.h>
int main(int argc, char* argv[]) {
vtkNew<vtkNamedColors> colors;
vtkNew<vtkDataSetReader> fileReader;
// Read .vtk file,can replace in your vtk name
fileReader->SetFileName("direction_3_5000.vtk");
fileReader->Update();
vtkNew<vtkDataSetMapper> mapper;
mapper->SetInputData(fileReader->GetOutput());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkNew<vtkRenderer> renderer;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("test");
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(actor);
renderer->SetBackground(colors->GetColor3d("DarkOliveGreen").GetData());
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}