View Issue Details

IDProjectCategoryView StatusLast Update
0029412CommunityOCCT:Visualizationpublic2018-06-29 21:21
Reporteruhammoud Assigned Tobugmaster  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformWindowsOSWindows 7 
Product Version6.9.0 
Target Version7.3.0Fixed in Version7.1.0 
Summary0029412: Huge Memory leak since I upgraded to OC 6.9.0
DescriptionThe memory leak still exists in OC 7.2. To reproduce the memory leak, please run this code and watch how the memory grows.


void DrawcircleLoop()
{
    for(int m_loopIndex = 0; m_loopIndex < 10000; m_loopIndex++)
    {
        gp_Pnt pos;
        gp_Vec dir(0, 0,1);

        gp_Ax2 center (pos, dir);
        gp_Circ circle (center, 1);
        Handle(AIS_Shape) feature;
        
        BRepBuilderAPI_MakeEdge builder( circle );
        
        if( builder.Error() == BRepBuilderAPI_EdgeDone )
        {
            TopoDS_Edge E1 = builder.Edge();
            TopoDS_Shape W2 = BRepBuilderAPI_MakeWire(E1).Wire();
            feature = new AIS_Shape(W2);
            myAISContext->Display(feature);
        }
        
        myViewer->Update();
        myV2dView->FitAll();
        myAISContext->Remove(feature);
    }
}
Steps To Reproducevtest command source code:
#include <AIS_Shape.hxx>
#include <gp_Circ.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <TopoDS_Wire.hxx>
static Standard_Integer VTest (Draw_Interpretor& /*theDI*/, Standard_Integer theArgNb, const char** theArgVec)
{
  Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
  if (aCtx.IsNull())
  {
    std::cout << "Error: no active view.\n";
    return 1;
  }

  const int aNbIters = 10000;
  int aProgressPrev = -1;
  for (int m_loopIndex = 0; m_loopIndex < aNbIters; m_loopIndex++)
  {
    gp_Pnt pos;
    gp_Vec dir(0, 0,1);

    gp_Ax2 center (pos, dir);
    gp_Circ circle (center, 1);
    Handle(AIS_Shape) feature;

    BRepBuilderAPI_MakeEdge builder( circle );

    if( builder.Error() == BRepBuilderAPI_EdgeDone )
    {
      TopoDS_Edge E1 = builder.Edge();
      TopoDS_Shape W2 = BRepBuilderAPI_MakeWire(E1).Wire();
      feature = new AIS_Shape(W2);
      aCtx->Display (feature, true);
    }

    aCtx->CurrentViewer()->Update();
    ViewerTest::CurrentView()->FitAll();
    aCtx->Remove (feature, true);

    const int aProgress = (m_loopIndex * 100) / aNbIters;
    if (aProgress != aProgressPrev)
    {
      std::cerr << aProgress << "%\r";
      aProgressPrev = aProgress;
    }
  }
  return 0;
}


Test script:
pload VISUALIZATION
vcaps -vsync 0
vinit View1
vglinfo
meminfo
vmemgpu
vtest
meminfo
vmemgpu 


Unmodified original test code:
void DrawcircleLoop()
{	
    for(int m_loopIndex = 0; m_loopIndex < 10000; m_loopIndex++)
    {
        gp_Pnt pos;
        gp_Vec dir(0, 0,1);

        gp_Ax2 center (pos, dir);
        gp_Circ circle (center, 1);
        Handle(AIS_Shape) feature;
        
        BRepBuilderAPI_MakeEdge builder( circle );
        
        if( builder.Error() == BRepBuilderAPI_EdgeDone )
        {
            TopoDS_Edge  E1 = builder.Edge();				
            TopoDS_Shape  W2 = BRepBuilderAPI_MakeWire(E1).Wire();					
            feature = new AIS_Shape(W2);
            myAISContext->Display(feature);		
        }
        
        myViewer->Update();	
        myV2dView->FitAll();
        myAISContext->Remove(feature);
    }
}
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • Driver_version_Using_OpenGL_Ext.txt (36,397 bytes)
  • NVIDIA System Information 01-09-2018 10-43-32.txt (3,848 bytes)

Relationships

related to 0029057 closedbugmaster Open CASCADE Tests - unstable test case bugs/vis/bug5682 

Activities

kgv

2018-01-07 15:54

developer   ~0073241

I don't see any "Huge Memory leak" on provided test case (see test Draw Harness test case based on your code sample):
Draw[4]> meminfo
  Private memory:     78 MiB
  Working Set:        75 MiB (peak: 75 MiB)
  Pagefile usage:     78 MiB (peak: 78 MiB)
  Virtual memory:     394 MiB
  Heap memory:     1 MiB
Draw[6]> vtest
0%
...
99%
Draw[10]> mem
  Private memory:     85 MiB
  Working Set:        82 MiB (peak: 93 MiB)
  Pagefile usage:     85 MiB (peak: 111 MiB)
  Virtual memory:     410 MiB
  Heap memory:     1 MiB


Please elaborate in more details your use case, tested configuration and how memory issue has been detected.

Note that OCCT 3D Viewer relies on OpenGL, which means that memory leaks observed on particular system might be caused by bugs in GPU drivers.
Upgrading/downgrading drivers might solve the problem.

uhammoud

2018-01-08 21:11

reporter   ~0073254

I am tracking memory using the task manager. I look at “Peak Working Set” and “Private Working Set”. For each run, the memory grows by 28MB. Memory readings are as follows:

Before first run: Peak = 49,620k, Private = 18,292k
After first run Peak = 78,084K, Private = 47,180
After second run: Peak = 101,712K, Private = 76,176K

O/S: Windows 7 64-bit
OpenGL version 4.4
OpenGL driver version: Forceware 7.1.542.0 22-May-06

I used the same system to compare OC 6.5.3 and OC 6.9.0. Version 6.9.0 produced the leak but version 6.5.3 did not on the same system.

kgv

2018-01-09 10:02

developer   ~0073257

The problem is not reproducible on my system, so I suppose this is an issue with your NVIDIA drivers (note that they are quite old).

The fact, that the memory issue was not appeared on your configuration at this scenario on earlier OCCT version is unrelated.

uhammoud

2018-01-09 19:34

reporter  

Driver_version_Using_OpenGL_Ext.txt (36,397 bytes)

uhammoud

2018-01-09 19:34

reporter  

NVIDIA System Information 01-09-2018 10-43-32.txt (3,848 bytes)

uhammoud

2018-01-09 19:36

reporter   ~0073279

The memory leak may not be huge but we run programs over and over all day, and eventually it accumulates over a GB. I updated the Nvidia driver to the latest version. I am now at:

Version: 4.6.0 NVIDIA 390.65
OpenGL 4.6 (was 4.4)

I attached 2 reports about the graphics components of my system after the upgrade. I noticed no improvement in the memory leak after the driver update. The memory leak has been detected on 4 other systems.

kgv

2018-01-10 14:22

developer   ~0073283

Please try Draw Harness test in Steps to Reproduce on your system (based on your code sample).
I don't see any memory leak on NVIDIA drivers - so either, something is missing in test, or problem is reproducible only on specific configurations.

Draw[4]> vglinfo
OpenGL info:
  GLvendor: NVIDIA Corporation
  GLdevice: GeForce GTX 650/PCIe/SSE2
  GLversion: 4.5.0 NVIDIA 385.69
  GLSLversion: 4.50 NVIDIA

uhammoud

2018-01-13 01:36

reporter   ~0073399

I tried the Draw Harness test. Here's what I got:

Draw[1]> pload VISUALIZATION
Draw[2]> vcaps -vsync 0
Error: unknown argument '-vsync'
Draw[3]> vinit View1
Driver1/Viewer1/View1
Draw[4]> vglinfo
OpenGL info:
  GLvendor = 'NVIDIA Corporation'
  GLdevice = 'Quadro M4000/PCIe/SSE2'
  GLversion = '4.6.0 NVIDIA 390.65'
  GLSLversion = '4.60 NVIDIA'

Draw[5]> meminfo
  Private memory: 80 MiB
  Working Set: 70 MiB (peak: 78 MiB)
  Pagefile usage: 80 MiB (peak: 80 MiB)
  Virtual memory: 234 MiB
  Heap memory: 1 MiB

Draw[6]> vmemgpu
  GPU free memory: 7980 MiB
  GPU memory: 8192 MiB

Draw[7]> vtest
0%
1%
.
.
.
98%
99%
Draw[8]> meminfo
  Private memory: 114 MiB
  Working Set: 98 MiB (peak: 99 MiB)
  Pagefile usage: 114 MiB (peak: 116 MiB)
  Virtual memory: 270 MiB
  Heap memory: 23 MiB

Draw[9]> vmemgpu
  GPU free memory: 7976 MiB
  GPU memory: 8192 MiB

Draw[10]>

abv

2018-01-13 09:21

manager   ~0073400

I can reproduce the problem (heap memory leak ~ 19 MiB per test run) with OCCT 6.9.0 and 7.0.0 but not with 7.1.0 nor 7.2.0 nor current master. This means the problem existed but has been fixed in OCCT 7.1.0.

My OpenGL info:
  GLvendor: Intel
  GLdevice: Intel(R) HD Graphics 4600
  GLversion: 4.3.0 - Build 20.19.15.4835
  GLSLversion: 4.30 - Build 20.19.15.4835
  Max texture size: 16384
  Max MSAA samples: 8
  Viewport: 409x409
  ResolutionRatio: 1

I used VS 2010 64-bit.

abv

2018-01-13 09:24

manager   ~0073401

@uhammoud: please confirm that the problem is not reproduced with OCCT 7.1.0+. If it is, please provide reproducer and specify more precisely your configuration (e.g. give output of DRAW command "dversion").

uhammoud

2018-01-15 22:54

reporter   ~0073423

I upgraded to OC 7.2 on the same machine I used for earlier tests. The test ran significantly faster and memory results were as follows:

Draw[1]> dversion
Open CASCADE Technology 7.2.0
Debug mode
TBB disabled
GL2PS disabled
FreeImage disabled
FFmpeg disabled
OpenGL: desktop
VTK disabled
Exceptions enabled
Compiler: MS Visual C++ 10.0 (_MSC_FULL_VER = 160040219)
Architecture: Intel x86
OS: Windows

Draw[2]> pload VISUALIZATION
Draw[3]> vcaps -vsync 0
Draw[4]> vinit View1
Driver1/Viewer1/View1
Draw[5]> vglinfo
OpenGL info:
  GLvendor: NVIDIA Corporation
  GLdevice: Quadro M4000/PCIe/SSE2
  GLversion: 4.6.0 NVIDIA 390.65
  GLSLversion: 4.60 NVIDIA
  Max texture size: 16384
  Max combined texture units: 192
  Max MSAA samples: 64
  Viewport: 409x409
  GPU free memory: 7963 MiB
  GPU memory: 8192 MiB
  ResolutionRatio: 1
Draw[6]> meminfo
  Private memory: 76 MiB
  Working Set: 73 MiB (peak: 81 MiB)
  Pagefile usage: 76 MiB (peak: 76 MiB)
  Virtual memory: 267 MiB
  Heap memory: 0 MiB

Draw[7]> vmemgpu
  GPU free memory: 7963 MiB
  GPU memory: 8192 MiB
Draw[8]> vtest
0%
1%
2%
3%
4%
5%

95%
96%
97%
98%
99%
Draw[9]> meminfo
  Private memory: 77 MiB
  Working Set: 77 MiB (peak: 81 MiB)
  Pagefile usage: 77 MiB (peak: 78 MiB)
  Virtual memory: 269 MiB
  Heap memory: 0 MiB

kgv

2018-01-16 19:42

developer   ~0073448

So, bug can be closed?

abv

2018-01-17 09:05

manager   ~0073450

If the good state of 7.2.0 is confirmed, I propose that we close the issue but add a test for this use case, to protect from possible future regressions.

uhammoud

2018-01-18 01:09

reporter   ~0073484

I did additional testing and I can confirm that the memory leak is fixed in 7.2.0.

Thanks for your help!

kgv

2018-01-19 10:54

developer   ~0073512

Last edited: 2018-01-19 10:54

> I propose that we close the issue but add a test for this use case,
> to protect from possible future regressions.
I don't see much difference of this test case from bugs/vis/bug5682, so I propose closing the issue without extra steps.

uhammoud

2018-01-19 19:34

reporter   ~0073543

I agree the issue is resolved. We can close it

abv

2018-01-25 05:10

manager   ~0073585

In my experiment test bugs vis bug5682 does not show memory leak on OCCT 6.9.1 or 7.0.0; thus a new test is to be created

git

2018-03-15 10:40

administrator   ~0074492

Branch CR29412 has been created by abv.

SHA-1: 5ed4dbd291c73335eda9a7170fb9fe5cd9de17a0


Detailed log of new commits:

Author: abv
Date: Thu Mar 15 10:39:55 2018 +0300

    0029412: Huge Memory leak since I upgraded to OC 6.9.0
    
    Added non-regression test bugs vis bug29412

git

2018-03-15 15:00

administrator   ~0074498

Branch CR29412 has been updated by abv.

SHA-1: 7a7972731c27ee2deb3ecc2b0908cdc3578f50de


Detailed log of new commits:

Author: abv
Date: Thu Mar 15 14:59:52 2018 +0300

    # Minor update of test

git

2018-03-15 15:22

administrator   ~0074499

Branch CR29412 has been updated by abv.

SHA-1: 72353100143b6bee46bc5397151e57edc9ff767a


Detailed log of new commits:

Author: abv
Date: Thu Mar 15 15:22:03 2018 +0300

    # trials...

git

2018-03-15 15:47

administrator   ~0074500

Branch CR29412 has been updated by abv.

SHA-1: 6921be6bdca1dd86b6ce731369aa661e51f6884b


Detailed log of new commits:

Author: abv
Date: Thu Mar 15 15:47:18 2018 +0300

    # more experiments

git

2018-03-15 15:57

administrator   ~0074502

Branch CR29412 has been updated forcibly by abv.

SHA-1: 44c65c2c447e76a2d5d538be5d68041653a4148f

abv

2018-03-15 18:02

manager   ~0074512

I have added test for memory leak on this use case; please review it in branch CR29412. Note that in OCCT 7.0.0 this tests shows leak of 19 MiB.

The test now checks for the leak starting from 100 KiB; this is because on Debian workstation with NVidia GT 750 graphics card it still shows some increase of the heap memory (~ 75 KiB), which gets less if test is repeated. This does not look to be a leak in OCCT (since it is not reproduced on Windows), and is likely caused by graphic driver using the same C heap as OCCT.

kgv

2018-03-15 22:13

developer   ~0074519

I'm against ugly QA tests, but anyway...

git

2018-03-19 10:05

administrator   ~0074605

Branch CR29412 has been deleted by kgv.

SHA-1: 44c65c2c447e76a2d5d538be5d68041653a4148f

Related Changesets

occt: master 9fb8f3f1

2018-03-15 07:39:55

abv


Committer: bugmaster Details Diff
0029412: Huge Memory leak since I upgraded to OC 6.9.0

Added non-regression test bugs vis bug29412
Affected Issues
0029412
mod - src/QABugs/QABugs_19.cxx Diff File
add - tests/bugs/vis/bug29412 Diff File

Issue History

Date Modified Username Field Change
2018-01-03 19:24 uhammoud New Issue
2018-01-03 19:24 uhammoud Assigned To => kgv
2018-01-07 15:48 kgv Steps to Reproduce Updated
2018-01-07 15:54 kgv Note Added: 0073241
2018-01-07 15:54 kgv Assigned To kgv => uhammoud
2018-01-07 15:54 kgv Status new => feedback
2018-01-07 15:54 kgv Steps to Reproduce Updated
2018-01-08 21:11 uhammoud Note Added: 0073254
2018-01-09 10:02 kgv Note Added: 0073257
2018-01-09 10:02 kgv Resolution open => unable to reproduce
2018-01-09 19:34 uhammoud File Added: Driver_version_Using_OpenGL_Ext.txt
2018-01-09 19:35 uhammoud File Added: NVIDIA System Information 01-09-2018 10-43-32.txt
2018-01-09 19:36 uhammoud Note Added: 0073279
2018-01-10 10:28 bugmaster Assigned To uhammoud => kgv
2018-01-10 14:22 kgv Note Added: 0073283
2018-01-10 14:22 kgv Assigned To kgv => uhammoud
2018-01-13 01:36 uhammoud Note Added: 0073399
2018-01-13 08:49 abv Steps to Reproduce Updated
2018-01-13 09:21 abv Note Added: 0073400
2018-01-13 09:24 abv Note Added: 0073401
2018-01-13 09:24 abv Product Version 7.2.0 => 6.9.0
2018-01-13 09:24 abv Fixed in Version => 7.1.0
2018-01-15 22:54 uhammoud Note Added: 0073423
2018-01-16 19:42 kgv Note Added: 0073448
2018-01-17 09:05 abv Note Added: 0073450
2018-01-18 01:09 uhammoud Note Added: 0073484
2018-01-19 10:49 kgv Relationship added related to 0029057
2018-01-19 10:54 kgv Note Added: 0073512
2018-01-19 10:54 kgv Assigned To uhammoud => abv
2018-01-19 10:54 kgv Note Edited: 0073512
2018-01-19 19:34 uhammoud Note Added: 0073543
2018-01-25 05:10 abv Note Added: 0073585
2018-03-13 14:51 kgv Target Version => 7.3.0
2018-03-15 10:40 git Note Added: 0074492
2018-03-15 15:00 git Note Added: 0074498
2018-03-15 15:22 git Note Added: 0074499
2018-03-15 15:47 git Note Added: 0074500
2018-03-15 15:57 git Note Added: 0074502
2018-03-15 18:02 abv Note Added: 0074512
2018-03-15 18:02 abv Assigned To abv => kgv
2018-03-15 18:02 abv Status feedback => resolved
2018-03-15 22:13 kgv Note Added: 0074519
2018-03-15 22:13 kgv Assigned To kgv => bugmaster
2018-03-15 22:13 kgv Status resolved => reviewed
2018-03-16 14:20 bugmaster Status reviewed => tested
2018-03-18 13:21 bugmaster Changeset attached => occt master 9fb8f3f1
2018-03-18 13:21 bugmaster Status tested => verified
2018-03-18 13:21 bugmaster Resolution unable to reproduce => fixed
2018-03-19 10:05 git Note Added: 0074605
2018-03-19 10:45 bugmaster Test case number => Not needed
2018-06-29 21:21 aiv Status verified => closed