Archived issue #0027604
Application Framework - memory is not released after closing XBF file
Description
BinLDrivers_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:
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 reproduce
bugs caf bug27604
Public activity
12 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
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
[revision removed]
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
Patch is ready for review. Branch CR27604.
- 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
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: mpv
Date: Wed Oct 12 14:48:50 2016 +0300
Roll back of cosmetic changes
[revision removed]
Detailed log of new commits:
Author: mpv
Date: Wed Oct 12 14:48:50 2016 +0300
Roll back of cosmetic changes
Reviewed.
Dear mpv,
could you please rebase branch CR27604 on current master, there are conflict files.
[revision removed]
could you please rebase branch CR27604 on current master, there are conflict files.
[revision removed]
Branch [archived branch] has been created by Participant.
[revision removed]
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
[revision removed]
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
The rebased branch CR27604_1 is created.
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.
[revision removed]
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.
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.
[revision removed]
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.
Dear BugMaster,
Branch CR27604_1 is TESTED.
Branch CR27604_1 is TESTED.
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]