[vtkusers] Release Memory , correct?

RIVERA ROLDAN, Jorge Orlando Orlando.RIVERA at mtu.de
Thu Oct 22 05:50:03 EDT 2015


One Update

I have tried too:
    gridPointer->GetActualMemorySize()   // After
    gridPointer->ReleaseData();
    gridPointer->Squeeze();
    gridPointer->GetActualMemorySize()   // Before

,and  I  have  omitted   adding an emptyGrid
    /*  vtkSmartPointer<vtkDataSet> emptyGrid;
    level2Pointer->SetBlock(k, emptyGrid):*/

MemorySize After seems to be consistent with my data and  MemorySize  Before  prints 0 (Zero)  but top  indicates  memory is increasing every time I read the Grids again and again  (see:  if (load (cnt) … ) in my  inner for loop )

How come?   maybe  it is my  DownCasting vtkSmartPointer<vtkDataSet>  since  they point to an StructuredGrid, which does not re-implement squeeze or ReleaseData (inherited  from vtkDataSet )

Von: RIVERA ROLDAN, Jorge Orlando
Gesendet: Tuesday, 20. October 2015 09:17
An: vtkusers at vtk.org
Betreff: Release Memory , correct?

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/20151022/c96f5e80/attachment.html>


More information about the vtkusers mailing list