[Paraview-developers] Release memory
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Thu Oct 22 11:50:36 EDT 2015
Hi,
Sorry, still wrapping my head around your use-case:
1. What would be a the cause of the RequestData() being called again?
Change in timestep?
2. Each time RequestData() is called, the output data (which is same
as root, I am assuming) will always be initialized, thus it won't have
any structure present. So I am not sure how your reader is working :).
If you have sample code + datafile that you can share, it may make
this easier. I am sure I am just missing something simple in your
workflow, that will help unravel it all :).
Utkarsh
On Thu, Oct 22, 2015 at 11:36 AM, RIVERA ROLDAN, Jorge Orlando
<Orlando.RIVERA at mtu.de> wrote:
> Thanks for the reply , I will try to explain as concise as I can
>
> The workflow is in the RequestData the tree Structure is build the first time a RequetData is called
>
> RequestData(){
>
> If ( !this->treeBuilt)
> {
> buildTree();
> this->treeBuilt=true;
> }
>
> readGrid();
>
> }
>
>
> In buildTree() I have built the tree using the same loop as described like :
>
> root->SetNumberOfBlocks(10); // 10 is just an example
> for( i=0 ; i< root->GetNumberOfBlocks() ; ++i )
> {
> vtkSmartPointer<vtkSmavtkMultiBlockDataSet>
> level2Pointer=vtkMultiBlockDataSet::SafeDownCast(Root->GetBlock(i));
> level2Pointer->SetNumberOfBlocks(5) //5 just an example
> for(k=0; k< level2Pointer->GetNumberOfBlocks(); k++){
> vtkSmartPointer<vtkDataSet> grid;
> grid=vtkStructuredGrid::New()
> level2Pointer->SetBlock(k,grid);
> }
> }
>
>
> so when RequesData is triggered for the very firs time my tree has a fixed structure and in ReadGrid just fill or release the Data (see original question) in my tree . Moreover, the blocks are always the same meaning :
> level2Pointer->SetBlock(2,grid); ( block 2 will always have the same grid same points same connectivity , same fields, etc )
>
> I also take in account that in case a block is set cannot be set until the releseasedata was first caIled
> Ie. I should not call
> level2Pointer->SetBlock(2,grid); twice in ReadGrid() without
>
> {
> gridPointer=vtkDataSet::SafeDownCast(level2Pointer->GetBlock(2));
> gridPointer->Releasedata();
> }
>
> In between
>
> Thanks again
>
>
> No there is no Other pluings is just , the reader
>
>
> -----Ursprüngliche Nachricht-----
> Von: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
> Gesendet: Thursday, 22. October 2015 16:51
> An: RIVERA ROLDAN, Jorge Orlando
> Cc: paraview-developers at paraview.org
> Betreff: Re: [Paraview-developers] Release memory
>
> Can you elaborate more? I cannot understand how you're attempting to
> call this code to release memory in a ParaView workflow? Is this being
> done is the reader's RequestData method? Are there any filters
> connected to the reader? Are you showing the output from the reader in
> a view?
>
> On Thu, Oct 22, 2015 at 5:36 AM, RIVERA ROLDAN, Jorge Orlando
> <Orlando.RIVERA at mtu.de> wrote:
>> Dear Forums Members,
>>
>>
>>
>> I post this on VTK , so I hope I am not generating spam
>>
>>
>>
>> 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):
>>
>>
>>
>> PS I also tried :
>>
>> gridPointer->Squeeze();
>>
>> and/or commeting out these lines :
>>
>> 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.
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at:
>> http://markmail.org/search/?q=Paraview-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview-developers
>>
> --
> 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.
More information about the Paraview-developers
mailing list