[vtkusers] Release Memory , correct?
RIVERA ROLDAN, Jorge Orlando
Orlando.RIVERA at mtu.de
Tue Oct 20 03:16:30 EDT 2015
Dear Forums Members,
I have a question regarding releasing Memory.
I have a vtkCompositeDataSet or a vtkMultiBlockDataSet up to 2 Levels. Level3 is a Structured or Unstructured grid, like :
--vtkMB (root )
-----vtkMB
---------vtkStructured
---------vtkUnstructured
-----vtkMB
and I want to release memory without destroying my tree structure
I get through my tree (simplified code )
for( i=0 ; i< root->GetNumberOfBlocks() ; ++i )
{
vtkSmartPointer<vtkSmavtkMultiBlockDataSet> level2Pointer=vtkMultiBlockDataSet::SafeDownCast(Root->GetBlock(i));
for(k=0; k< level2Pointer->GetNumberOfBlocks(); k++)
{
If( load(cnt) )
{
vtkSmartPointer<vtkDataSet> gridPointer=ReadGridFromFile(…..)
level2Pointer->SetBlock(k, gridPointer):
}
else
{
vtkSmartPointer<vtkDataSet> gridPointer=vtkDataSet::SafeDownCast(level2Pointer->GetBlock(k));
gridPointer->ReleaseData();
vtkSmartPointer<vtkDataSet> emptyGrid;
level2Pointer->SetBlock(k, emptyGrid):
}
cnt++;
} //for k
} //for i
As you can see I get the Un/Structured grid pointed with the gridPointer . I try to release the Memory an in its place I set an empty grid
All works really nice, when I want to render a grid, I load it in first IF , otherwise, in else will be supposedly released . When I see it with top or mem inspector the memory is actually increasing.
So I assume I am doing something wrong in the else part:
vtkSmartPointer<vtkDataSet> gridPointer=vtkDataSet::SafeDownCast(level2Pointer->GetBlock(k));
gridPointer->ReleaseData();
vtkSmartPointer<vtkDataSet> emptyGrid;
level2Pointer->SetBlock(k, emptyGrid):
Any help will be appreciated
Thanks !!
--
MTU Aero Engines AG
Vorstand/Board of Management: Reiner Winkler, Vorsitzender/CEO; Dr. Rainer Martens, Michael Schreyoegg
Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Klaus Eberhardt
Sitz der Gesellschaft/Registered Office: Muenchen
Handelsregister/Commercial Register: Muenchen HRB 157206
Diese E-Mail sowie ihre Anhaenge enthalten MTU-eigene vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte den Absender und loeschen Sie diese
E-Mail sowie die Anhaenge. Das unbefugte Speichern, Kopieren oder Weiterleiten ist nicht gestattet.
This e-mail and any attached documents are proprietary to MTU, confidential or protected by law.
If you are not the intended recipient, please advise the sender and delete this message and its attachments.
Any unauthorised storing, copying or distribution is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151020/7407cc0d/attachment.html>
More information about the vtkusers
mailing list