Hello,
I found vtkTextActor memory leak when i put random number in to vtkTextActor color.
(VTK : 9.3, QT : 5.15.2)
Below is a simplified version of the code. If you insert a random number into the code, it leaks memory but fixed value does not leak memory.
This->lifecycle_ptr->textfactor->GetTextProperty()->SetColor(r, g, b);
Can you help me?
...
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> dis(0, 1);
for (int i = 0; i < 8; i++) {
double r = dis(gen);
double g = dis(gen);
double b = dis(gen);
// textactor
this->lifecycle_ptr->textactor = vtkSmartPointer<vtkTextActor>::New();
this->lifecycle_ptr->textactor->GetTextProperty()->SetFontSize(24);
std::string text = "hello" + std::to_string(i);
this->lifecycle_ptr->textactor->SetInput(text.c_str());
this->lifecycle_ptr->textactor->SetPosition(10, height);
this->lifecycle_ptr->textactor->GetTextProperty()->SetColor(r, g, b); // memory leak
//this->lifecycle_ptr->textactor->GetTextProperty()->SetColor(0.1, 0.2, 0.3); // no memory leak
height = height - 40;
}
...