View Issue Details

IDProjectCategoryView StatusLast Update
0027604Open CASCADEOCCT:Application Frameworkpublic2016-12-09 16:38
Reporterkgv Assigned Toapn  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version7.0.0 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027604: Application Framework - memory is not released after closing XBF file
DescriptionBinLDrivers_DocumentRetrievalDriver uses BinMNaming_NamedShapeDriver, which creates map of shapes. While reading XBF file this map is filled up, however after reading is done the map is still there and even closing the document does not release the memory.

The following code can be found in some applications as a workaround, but it can not be justified:
class CustomDriver : public BinXCAFDrivers_DocumentRetrievalDriver
{
public:
  virtual void Read (Standard_IStream&               theIStream,
                     const Handle(Storage_Data)&     theStorageData,
                     const Handle(CDM_Document)&     theDoc,
                     const Handle(CDM_Application)&  theApplication)
  {
    BinLDrivers_DocumentRetrievalDriver::Read (theIStream, theStorageData, theDoc, theApplication);
    if (!myDrivers.IsNull())
    {
      Handle(BinMDF_ADriver) aDriver;
      myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape), aDriver);
      Handle(BinMNaming_NamedShapeDriver) aShapesDriver = Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
      if (!aShapesDriver.IsNull())
      {
        aShapesDriver->Clear();
      }
    }
Steps To Reproducebugs caf bug27604
TagsNo tags attached.
Test case numberbugs caf bug27604

Activities

git

2016-10-12 11:02

administrator   ~0058602

Branch CR27604 has been created by mpv.

SHA-1: 555868e314dc991061fbfedafb48e94b4ad7ee24


Detailed log of new commits:

Author: mpv
Date: Wed Oct 12 11:02:02 2016 +0300

     Application Framework - memory is not released after closing XBF file

mpv

2016-10-12 11:12

developer   ~0058604

Patch is ready for review. Branch CR27604.

kgv

2016-10-12 14:18

developer   ~0058615

-  Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(CDM_MessageDriver)& theMsgDriver) Standard_OVERRIDE;
+  Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers(const Handle(CDM_MessageDriver)& theMsgDriver) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void ReadShapeSection (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS, const Standard_Boolean isMess = Standard_False) Standard_OVERRIDE;
+  Standard_EXPORT virtual void ReadShapeSection(BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS, const Standard_Boolean isMess = Standard_False) Standard_OVERRIDE;
   
-  Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS) Standard_OVERRIDE;
+  Standard_EXPORT virtual void CheckShapeSection(const Storage_Position& thePos, Standard_IStream& theIS) Standard_OVERRIDE;

Please avoid mixing cosmetic and functional changes within the same patch.
Note that this bracket spacing change contradicts to recommended coding style - see chapter "Separating spaces" and related code samples:
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__coding_rules.html#occt_coding_rules_3

git

2016-10-12 14:55

administrator   ~0058616

Branch CR27604 has been updated by mpv.

SHA-1: d9ab5b14589f85c0af6f0c9522cb40d599f7c787


Detailed log of new commits:

Author: mpv
Date: Wed Oct 12 14:48:50 2016 +0300

    Roll back of cosmetic changes

szy

2016-10-13 18:17

manager   ~0058686

Reviewed.

mkv

2016-10-14 15:01

tester   ~0058730

Dear mpv,
could you please rebase branch CR27604 on current master, there are conflict files.
SHA-1: d9ab5b14589f85c0af6f0c9522cb40d599f7c787

git

2016-10-14 15:51

administrator   ~0058740

Branch CR27604_1 has been created by mpv.

SHA-1: 4ac5e2b9ce5a90539961d4e07cd5ab431051edbd


Detailed log of new commits:

Author: mpv
Date: Wed Oct 12 11:02:02 2016 +0300

     Application Framework - memory is not released after closing XBF file

Author: mpv
Date: Wed Oct 12 14:48:50 2016 +0300

    Roll back of cosmetic changes

mpv

2016-10-14 15:57

developer   ~0058741

The rebased branch CR27604_1 is created.

mkv

2016-10-17 13:02

tester   ~0058782

Dear BugMaster,
Branch CR27604_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 4ac5e2b9ce5a90539961d4e07cd5ab431051edbd

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1136

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27604_1-master-OCCT/Debian70-64/bugs/caf/bug27604.html

http://occt-tests/CR27604_1-master-OCCT/Windows-64-VC10/bugs/caf/bug27604.html

bugs caf bug27604: OK

Testing on Linux:
occt component :
Total MEMORY difference: 90594299 / 90590165 [+0.00%]
Total CPU difference: 19445.61999999991 / 19464.819999999938 [-0.10%]
products component :
Total MEMORY difference: 30069952 / 30069397 [+0.00%]
Total CPU difference: 5301.37999999998 / 5271.849999999968 [+0.56%]

Testing on Windows:
occt component :
Total MEMORY difference: 57228459 / 57250244 [-0.04%]
Total CPU difference: 18863.204117198624 / 18101.186032498666 [+4.21%]
products component :
Total MEMORY difference: 21302935 / 21265221 [+0.18%]
Total CPU difference: 5502.560872599972 / 5148.189000999964 [+6.88%]

There are no differences in images found by testdiff.

mkv

2016-10-17 13:03

tester   ~0058783

Dear BugMaster,
Branch CR27604_1 is TESTED.

git

2016-10-28 21:41

administrator   ~0059438

Branch CR27604 has been deleted by kgv.

SHA-1: d9ab5b14589f85c0af6f0c9522cb40d599f7c787

git

2016-10-28 21:41

administrator   ~0059439

Branch CR27604_1 has been deleted by kgv.

SHA-1: 4ac5e2b9ce5a90539961d4e07cd5ab431051edbd

Related Changesets

occt: master bf954475

2016-10-20 13:26:25

mpv


Committer: apn Details Diff
0027604: Application Framework - memory is not released after closing XBF file

Virtual method *BinLDrivers_DocumentRetrievalDriver::Clear* now allows to Clear a cash data accumulated during a reading.
So, in successor class BinDrivers_DocumentRetrievalDriver this allows clearing the BinMNaming_NamedShapeDriver set of stored shapes when it is not needed anymore.
Affected Issues
0027604
mod - src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx Diff File
mod - src/BinDrivers/BinDrivers_DocumentRetrievalDriver.hxx Diff File
mod - src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx Diff File
mod - src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.hxx Diff File
add - tests/bugs/caf/bug27604 Diff File

Issue History

Date Modified Username Field Change
2016-06-14 18:28 kgv New Issue
2016-06-14 18:28 kgv Assigned To => mpv
2016-10-12 11:02 git Note Added: 0058602
2016-10-12 11:11 mpv Steps to Reproduce Updated
2016-10-12 11:12 mpv Note Added: 0058604
2016-10-12 11:12 mpv Assigned To mpv => szy
2016-10-12 11:12 mpv Status new => resolved
2016-10-12 14:18 kgv Note Added: 0058615
2016-10-12 14:55 git Note Added: 0058616
2016-10-13 18:17 szy Note Added: 0058686
2016-10-13 18:17 szy Assigned To szy => bugmaster
2016-10-13 18:17 szy Status resolved => reviewed
2016-10-13 18:41 mkv Assigned To bugmaster => mkv
2016-10-14 15:01 mkv Note Added: 0058730
2016-10-14 15:01 mkv Assigned To mkv => mpv
2016-10-14 15:01 mkv Status reviewed => feedback
2016-10-14 15:51 git Note Added: 0058740
2016-10-14 15:57 mpv Note Added: 0058741
2016-10-14 15:57 mpv Assigned To mpv => mkv
2016-10-14 15:57 mpv Status feedback => reviewed
2016-10-17 13:02 mkv Note Added: 0058782
2016-10-17 13:03 mkv Note Added: 0058783
2016-10-17 13:03 mkv Assigned To mkv => bugmaster
2016-10-17 13:03 mkv Status reviewed => tested
2016-10-17 13:03 mkv Test case number => bugs caf bug27604
2016-10-21 11:25 apn Changeset attached => occt master bf954475
2016-10-21 11:25 apn Assigned To bugmaster => apn
2016-10-21 11:25 apn Status tested => verified
2016-10-21 11:25 apn Resolution open => fixed
2016-10-28 21:41 git Note Added: 0059438
2016-10-28 21:41 git Note Added: 0059439
2016-12-09 16:30 aiv Status verified => closed
2016-12-09 16:38 aiv Fixed in Version => 7.1.0