View Issue Details

IDProjectCategoryView StatusLast Update
0006046CommunityOCCT:Foundation Classespublic2011-12-15 16:39
ReporterabvAssigned Toabv 
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Fixed in Version5.2.0 
Summary0006046: Memory leak in math_StackManager
DescriptionThis bug has been reported on OCC Forum, see thread 5991:
http://www.opencascade.org/org/forum/thread_5991

The problem actually exists, but it is more complicated as it seems: the
mentioned method ReallocateStack is completely wrong by initial intent -- it
reallocates memory moving it to another address, while the pointers to original
memory location are still living (both outside and inside the stack).

It seems that this 'stack manager' has been created in attempt to optimise
memory allocation yet before creation of OCC memory manager. It is better just
to remove it and replace calls to it (found just in two places in the same
package: math_SingleTab and math_DoubleTab) to either standard malloc/free, or
to OCC MAllocate/MFree.

Also file math_MemoryManagement.hxx is not used and should be removed

The fix follows (see attachments)
Additional information
and documentation updates
Documentation remark, added by abv 2004-07-06 06:42:41:

Improvements:
Specific (stack-like) memory allocation mechanism used in array classes from
math package (such as math_RealVector) is replaced by usage of standard Open
CASCADE memory manager (from package Standard). This both optimises memory usage
and allows to avoid potential memory leaks (that might happen previously in case
of allocation of big amounts of memory in several arrays simultaneously).
Modified entities:
Package math:

math_StackManager.hxx and .cxx, math_MemoryManagement.hxx: deleted

math_SingleTab.gxx and math_DoubleTab.gxx: calls to math_StackManager functions
replaced by equivalent calls to Standard::Allocate() and Standard::Free()
TagsNo tags attached.
Test case number

Attached Files

  • occ6046-fix-040604.tar.gz (1,416 bytes)
  • test_bug_stack.tcl (746 bytes)
  • memory_test.tcl (685 bytes)
  • Mytest.cxx.gz (606 bytes)
  • math_vec.tcl (712 bytes)

Activities

2004-06-04 15:52

 

occ6046-fix-040604.tar.gz (1,416 bytes)

2004-06-04 15:52

 

test_bug_stack.tcl (746 bytes)

2004-06-18 08:41

 

memory_test.tcl (685 bytes)

2004-06-18 12:34

 

Mytest.cxx.gz (606 bytes)

2004-06-18 12:36

 

math_vec.tcl (712 bytes)

Issue History

Date Modified Username Field Change
2004-06-04 18:00 abv CC => msv
2004-06-07 08:46 bugmaster Assigned To bugmaster => abv
2004-06-07 08:46 bugmaster Status new => assigned
2004-06-07 08:47 bugmaster CC => mkv
2004-06-07 08:47 bugmaster Status assigned => resolved
2004-06-07 12:12 mkv CC => aki
2004-06-18 14:40 bugmaster Status resolved => tested
2004-08-02 18:03 bugmaster Status tested => closed
2004-08-02 18:03 bugmaster Fixed in Version => 5.1.3
2004-08-02 18:03 bugmaster Resolution @0@ => fixed
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2011-12-15 16:38 abv Description Updated
2011-12-15 16:38 abv Additional Information Updated
2011-12-15 16:39 abv Project Open CASCADE => Community