1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-25 12:04:07 +03:00

0026616: Memory leak in IntTools_Context::Hatcher

class IntTools_Context
- method:
Geom2dHatch_Hatcher& IntTools_Context::Hatcher
  (const TopoDS_Face& aF)
- method:
IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData
  (const TopoDS_Face& aF)

The memory allocation is provided using inner allocator of the object.

Test-case for issue #26616
This commit is contained in:
pkv 2015-09-17 16:10:18 +03:00 committed by bugmaster
parent 127cc1f0a1
commit f41525d378
2 changed files with 25 additions and 5 deletions

View File

@ -400,10 +400,11 @@ Geom2dHatch_Hatcher& IntTools_Context::Hatcher(const TopoDS_Face& aF)
aEpsT=Precision::PConfusion(); aEpsT=Precision::PConfusion();
// //
Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr); Geom2dHatch_Intersector aIntr(aTolArcIntr, aTolTangfIntr);
pHatcher=new Geom2dHatch_Hatcher(aIntr, pHatcher=(Geom2dHatch_Hatcher*)
myAllocator->Allocate(sizeof(Geom2dHatch_Hatcher));
new (pHatcher) Geom2dHatch_Hatcher(aIntr,
aTolHatch2D, aTolHatch3D, aTolHatch2D, aTolHatch3D,
Standard_True, Standard_False); Standard_True, Standard_False);
// //
aFF=aF; aFF=aF;
aFF.Orientation(TopAbs_FORWARD); aFF.Orientation(TopAbs_FORWARD);
@ -450,7 +451,9 @@ IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData
IntTools_SurfaceRangeLocalizeData* pSData; IntTools_SurfaceRangeLocalizeData* pSData;
// //
if (!myProjSDataMap.IsBound(aF)) { if (!myProjSDataMap.IsBound(aF)) {
pSData=new IntTools_SurfaceRangeLocalizeData pSData=(IntTools_SurfaceRangeLocalizeData*)
myAllocator->Allocate(sizeof(IntTools_SurfaceRangeLocalizeData));
new (pSData) IntTools_SurfaceRangeLocalizeData
(3, (3,
3, 3,
10. * Precision::PConfusion(), 10. * Precision::PConfusion(),

View File

@ -0,0 +1,17 @@
puts "========"
puts "OCC26616"
puts "========"
puts ""
############################################
# Memory leak in IntTools_Context::Hatcher
############################################
restore [locate_data_file OCC26635_t0.brep] t0
restore [locate_data_file OCC26635_t1.brep] t1
bfuse res t0 t1
set m0 [meminfo w]
repeat 10 {bfuse res t0 t1}
set m1 [meminfo w]
if {[expr {$m1 - $m0}] > 1048576} {
puts "ERROR: OCC26616 is reproduced. Memory leak has been detected."
}