MantisBT - Community
View Issue Details
0006046Community[OCCT] OCCT:Foundation Classespublic2004-06-04 17:472011-12-15 16:39
[OCCT] 5.2.0 
0006046: Memory leak in math_StackManager
This bug has been reported on OCC Forum, see 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)
Documentation remark, added by abv 2004-07-06 06:42:41:

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()
No tags attached.
gz occ6046-fix-040604.tar.gz (1,416) 2004-06-04 15:52
? test_bug_stack.tcl (746) 2004-06-04 15:52
? memory_test.tcl (685) 2004-06-18 08:41
gz Mytest.cxx.gz (606) 2004-06-18 12:34
? math_vec.tcl (712) 2004-06-18 12:36
Issue History
2004-06-04 18:00abvCC => msv
2004-06-07 08:46bugmasterAssigned Tobugmaster => abv
2004-06-07 08:46bugmasterStatusnew => assigned
2004-06-07 08:47bugmasterCC => mkv
2004-06-07 08:47bugmasterStatusassigned => resolved
2004-06-07 12:12mkvCC => aki
2004-06-18 14:40bugmasterStatusresolved => tested
2004-08-02 18:03bugmasterStatustested => closed
2004-08-02 18:03bugmasterFixed in Version => 5.1.3
2004-08-02 18:03bugmasterResolution@0@ => fixed
2011-08-02 11:23bugmasterCategoryOCCT:FDC => OCCT:Foundation Classes
2011-12-15 16:38abvDescription Updatedbug_revision_view_page.php?rev_id=1279#r1279
2011-12-15 16:38abvAdditional Information Updatedbug_revision_view_page.php?rev_id=1281#r1281
2011-12-15 16:39abvProjectOpen CASCADE => Community

There are no notes attached to this issue.