View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0022627 | Open CASCADE | OCCT:Modeling Algorithms | public | 2011-06-24 11:37 | 2013-05-24 12:37 |
Reporter | kgv | Assigned To | bugmaster | ||
Priority | high | Severity | feature | ||
Status | closed | Resolution | fixed | ||
OS | All | ||||
Target Version | 6.5.3 | Fixed in Version | 6.5.3 | ||
Summary | 0022627: Change OCCT memory management defaults | ||||
Description | Currently default settings are: MMGT_OPT = 1; MMGT_REENTRANT = 0; This corresponds to using of advanced OCCT memory manager Standard_MMgrOpt in thread-unsafe manner. There several reasons why current defaults are bad: - most mordern applications are multi-threaded and using thread-unsafe allocator will cause crashes forcing application to change defaults (however developer should found these settings - root cause of problems - first time he detect them and this is untrivial); - OS changed since Standard_MMgrOpt was firstly introduced; todays built-in system memory allocators already use same techniques (probably configured more optimally for mordern systems) and even more advanced (optimized for multi- threading applications). So there are no reasons to use limited advanced memory manager in OCCT and if user really need it - he should choose it consciously. Thus suggested changes: - change MMGT_OPT to 0 (will use Standard_MMgrRaw - wrapper over standard memory allocators); - change MMGT_REENTRANT to 1 (to make Standard_MMgrOpt thread-safe by default) or totally remove this parameter (always thread-safe). These changes require performance tests on mordern systems and on some existing single-threaded applications to make a decision. | ||||
Tags | No tags attached. | ||||
Test case number | no test case | ||||
related to | 0022734 | closed | Community | Memory allocation error in OpenGl | |
related to | 0022819 | closed | bugmaster | Open CASCADE | Redesign of OpenGl driver |
related to | 0023032 | closed | bugmaster | Open CASCADE | A crash of a draw-command voxeloctboolds on MMGT_OPT=0, MMGT_REENTRANT=1 |
related to | 0023988 | closed | Open CASCADE | Force use of reentrant mode |
|
See discussion on forum thread http://www.opencascade.org/org/forum/thread_21696 leading to the same conclusion |
|
Dear Kirill, Please prepare patch (to be tested and integrated). |
|
Branch http://svn/svn/occt/branches/OCC22627 was created for this BUG. Current changes applied: - MMGT_OPT default value changed to 0 (to use Standard_MMgrRaw - wrapper over standard memory allocators); - MMGT_REENTRANT default value changed to 1 (to make Standard_MMgrOpt thread-safe by default). |
|
Some minor remarks (stylistic): - Parameters bMMap, aCellSize, aNbPages, aThreshold are needed only if MMGT_OPT=1; hence they can be moved to relevant case of the switch - It would be reasonable to modify Standard_Reentrant only in the case if MMGT_REENTRANT is actually defined; furthermore it is better to use conditional statement instead of direct assignment (now it is possible to set Reentrant to e.g. -5). |
|
Remarks applied |
|
Reviewed without remarks. Please test ASAP as we expect to have "regressions" due to possible presence of bugs previously obscured by latency of memory release by OCCT memory manager |
|
Dear BugMaster, Workbench KAS:dev:mkv-OCC22627-occt has been created from SVN branch http://svn/svn/occt/branches/OCC22627 (and mkv-OCC22627-products from trunk) and compiled on Linux platform. There are folloving regressions in mkv-OCC22627-products regarding to KAS:dev:products-12092011-opt chl 901 A8 - *** Abort *** an exception was raised, but no catch was found. chl 927 V8 - *** Abort *** an exception was raised, but no catch was found. chl 928 O5 - *** Abort *** an exception was raised, but no catch was found. chl 928 R1 - memory leakage chl 929 E2 - *** Abort *** an exception was raised, but no catch was found. chl 937 C5 - *** Abort *** an exception was raised, but no catch was found. chl 941 A3 - *** Abort *** an exception was raised, but no catch was found. See results in /dn45/occttests/results/KAS/dev/mkv-OCC22627-products_13092011/lin See reference results in /dn45/occttests/results/KAS/dev/products-20110909-opt_12092011/lin See test cases in /dn45/occttests/tests/ED N.B. In order to launch testing case you can make use the following instructions http://doc/doku.php?id=occt:certification |
|
2apl, could you please look onto this issue? I found that test case 'chl 901 A8' raise segmentation violation after #22650 patch (revision 8920 in TRUNK). Notice that this happens on DRAWEXE exiting (thus probably caused problems in static memory management). To reproduce this you needn't compile branch for this bug - just change MMGT_OPT to 0 before launching DRAWEXE (set env(QA_DUMP) 1; set env(MMGT_OPT) 0; wokenv -s;). |
|
Hi Kirill, I've corrected problem with exceptions in graphic3d_group. However, the following cases raises exception anyway (even without patch 22650): 927/V8 937/C5 941/A3 The exceptions (which was corrected) were raised on update of Graphic3d_StructureManager by Graphic3d_Group before destruction. The pointer used for update operation is stored in Graphic3d_Structure and it isn't a handle to avoid cross-reference on destruction. The possible reason is that the V3d_Viewer keeps a handles to a graphical objects as a class fields, and a handle to structure manager. If the order of destruction is incorrect (structure manager destroyed first) then these objects calls invalid pointers on destruction. However, my newly integrated corrections to graphic3d_group fixes a mistake in graphic3d_structure::remove operation that due to this behavior leads to exception with MMGT_OPT=0. |
|
927/V8 exception is a result of early memory corruption which cause ~Draw_Viewer() destructor for one global instance called twice. This happens either when MMGT_OPT=0 and MMGT_OPT=1 but in second case double destruction passes silently due to laziness of OCCT optimized memory manager. The original corruption seems to be happens in TKOpenGl module and could be debugged using gdb on Linux platform (chl_928_V8_mmgtopt0.txt in attach is a valgrind log). The bug 0022734 may be root cause of this. |
|
chl_928_V8_mmgtopt0.txt (146,042 bytes) |
|
I have merged the code with current trunk and integrated one more change: activation of low-fragmentation heap on Windows, which allows to get best performance of standard memory manager on Windows XP and 2000. Environment variable MMGT_LFH can be used to avoid this setting (if set to 0). I suggest this fix is re-tested in its current state. Please review the change |
|
2abv > #if(defined(_WIN32) || defined(__WIN32__)) > ... > HANDLE aCRTHeap = (HANDLE)_get_heap_handle(); > #endif wrong macro used to determine _get_heap_handle() availability. Please test for MSVC compiler instead (mingw headers doesn't declare this function despite it declare it crt library) OR declare this function in our sources like "_CRTIMP intptr_t __cdecl _get_heap_handle(void);" > if ( ! aVar || atoi (aVar) != 0 ) Please use (aVar == NULL) check to improve readability... |
|
Code corrected, please check |
|
Patch is OK now. Dear bugmaster, please perform tests on this branch. |
2011-12-26 20:18 manager |
LP2-TestMemAlloc.xls (23,040 bytes) |
|
Attached file LP2-TestMemAlloc.xls provides results of testing of performance of importing big STEP file (184 Mb) in the customer's application with different memory options. It demonstrates that activation of low-fragmentation heap on Windows XP makes standard-memory manager even more performant than those of OCCT and TBB; on Windows 7 it is only 10% slower than TBB. At the same time, standard memory manager is almost twice less memory hungry as TBB! |
|
Dear BugMaster, Workbench KAS:dev:mkv-OCC22627-occt has been created from SVN branch http://svn/svn/occt/branches/OCC22627 (and mkv-OCC22627-products from trunk) and compiled on Linux platform. There are folloving regressions in mkv-OCC22627-products regarding to KAS:dev:products-20111216-opt chl 927 V8 chl 928 O5 chl 928 R1 chl 937 C5 chl 941 A3 See results in /QADisk/occttests/results/KAS/dev/mkv-OCC22627-products_27122011/lin See reference results in /QADisk/occttests/results/KAS/dev/products-20111216-opt_17122011/lin See test cases in /QADisk/occttests/tests/ED N.B. In order to launch testing case you can make use the following instructions http://doc/doku.php?id=occt:certification |
|
Dear Sergey, Please check reported regressions chl 928 R1 and O5 |
|
Please re-test on current version: most of the regressions should have been fixed by recent integrations. The fix is on the branch with the same name (OCC22627), rebased on current trunk |
|
Dear BugMaster, Workbench KAS:dev:aan-22627-occt from SVN branch http://svn/svn/occt/branches/OCC22627 (and aan-22627-products from trunk) was successfully compiled and tested on Linux. Workbench KAS:dev:aan-22627-products was tested with MMGT_OPT=1 and MMGT_REENTRANT=0 There are not regressions in aan-22627-products regarding to KAS:dev:products-20120217-opt See results in /QADisk/occttests/results/KAS/dev/aan-22627-products_21022012/lin See reference results in /QADisk/occttests/results/KAS/dev/products-20120217-opt_17022012/lin See test cases in /QADisk/occttests/tests/ED N.B. In order to launch testing case you can make use the following instructions http://doc/doku.php?id=occt:certification |
|
Dear BugMaster, Workbench KAS:dev:aan-22627-1-occt from SVN branch http://svn/svn/occt/branches/OCC22627 (and aan-22627-1-products from trunk) was successfully compiled and tested on Linux. Workbench KAS:dev:aan-22627-1-products was tested with MMGT_OPT=0 and MMGT_REENTRANT=1 There are following regressions in aan-22627-1-products regarding to KAS:dev:products-20120217-opt chl 928 R1 chl 936 G9 vpr 007 C1 C2 C3 C4 C5 C6 D1 D2 D3 D4 D5 D6 vpr 008 B2 B3 B5 C1 C2 C3 C4 C5 C6 D1 D2 D3 D4 D5 D6 vpr 0015 B1 B2 B3 B4 B5 B6 C1 C2 D1 D2 vpr 016 B1 B4 C1 C2 D1 See results in /QADisk/occttests/results/KAS/dev/aan-22627-1-products_21022012/lin See reference results in /QADisk/occttests/results/KAS/dev/products-20120217-opt_17022012/lin See test cases in /QADisk/occttests/tests/ED N.B. In order to launch testing case you can make use the following instructions http://doc/doku.php?id=occt:certification [^] |
|
chl 928 R1 - aka memory leak chl 936 G9 - exception, voxeloctboolds Increased memory usage: vpr 007 C1 C2 C3 C4 C6 - 1220 KB -> 1684 KB (limit 1308) vpr 007 C5 - 1220 KB -> 1356 KB (limit 1348) vpr 007 D1 - 1216 KB -> 1804 KB (limit 1324) vpr 007 D2 - 1216 KB -> 2072 KB (limit 1336) vpr 007 D3 - 1216 KB -> 1784 KB (limit 1320) vpr 007 D4 - 1216 KB -> 1396 KB (limit 1324) vpr 007 D5 - fit in limit vpr 007 D6 - 2008 KB -> 2232 KB (limit 2168) vpr 008 B2 - 1216 KB -> 2080 KB (limit 1360) vpr 008 B3 - 1216 KB -> 1700 KB (limit 1372) vpr 008 B5 - 1216 KB -> 1456 KB (limit 1356) vpr 008 C1 - 1220 KB -> 2076 KB (limit 1380) vpr 008 C2 - 1220 KB -> 2156 KB (limit 1384) vpr 008 C3 - 1220 KB -> 2168 KB (limit 1376) vpr 008 C4 - 1220 KB -> 2124 KB (limit 1376) vpr 008 C5 - 1220 KB -> 2120 KB (limit 1376) vpr 008 C6 - 1220 KB -> 2116 KB (limit 1372) vpr 008 D1 - 1216 KB -> 2096 KB (limit 1404) vpr 008 D2 - 1216 KB -> 2184 KB (limit 1404) vpr 008 D3 - 1216 KB -> 2172 KB (limit 1368) vpr 008 D4 - 1216 KB -> 2124 KB (limit 1392) vpr 008 D5 - 2008 KB -> 2896 KB (limit 2240) vpr 008 D6 - 2008 KB -> 2884 KB (limit 2236) vpr 015 B1 - 1216 KB -> 1608 KB (limit 1348) vpr 015 B2 - 1216 KB -> 1608 KB (limit 1360) vpr 015 B3 - 1216 KB -> 1608 KB (limit 1360) vpr 015 B4 - 1216 KB -> 1608 KB (limit 1344) vpr 015 B5 - 1216 KB -> 1608 KB (limit 1352) vpr 015 B6 - 1216 KB -> 1608 KB (limit 1356) vpr 015 C1 - 1216 KB -> 1608 KB (limit 1360) vpr 015 C2 - 1224 KB -> 2108 KB (limit 1364) vpr 015 D1 - 1216 KB -> 1608 KB (limit 1356) vpr 015 D2 - 1216 KB -> 2072 KB (limit 1360) vpr 016 B1 - 1216 KB -> 1608 KB (limit 1372) vpr 016 B4 - 1216 KB -> 1608 KB (limit 1364) vpr 016 C1 - 1216 KB -> 1608 KB (limit 1264) vpr 016 C2 - 1220 KB -> 2176 KB (limit 1324) vpr 016 D1 - 1216 KB -> 1608 KB (limit 1272) vpr 016 D2 - 1216 KB -> 2072 KB (limit 1320) |
|
Looks like there is no regressions in chl 928 R1 test and all listed vpr tests. For MMGT_OPT=0 tests should be differ, due to different memory manager and different memory usage. Dear VRO, Could you please take care about regression chl 936 G9 |
|
The regression chl 936 G9 is pure Voxel mistake in the method Voxel_OctBoolDS::OptimizeMemory(). The issue 22627 may ignore this crash, which will be fixed by another issue. |
|
The issue number for the fix of chl 936 G9 is 0023032 |
|
Please integrate (update chl 928 R1 and vpr test scripts for increased memory with MMGT_OPT=0 as needed) |
|
Dear BugMaster, SVN branch http://svn/svn/occt/branches/OCC22627 has been moved to GIT CR22627 one. |
|
Integrated into master |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-08-02 11:31 | bugmaster | Category | OCCT:MOA => OCCT:Modeling Algorithms |
2011-09-05 09:18 |
|
Test case number | => no test case |
2011-09-05 09:18 |
|
Note Added: 0018070 | |
2011-09-05 09:18 |
|
Assigned To | bugmaster => kgv |
2011-09-05 09:18 |
|
Status | new => assigned |
2011-09-05 09:18 |
|
Fixed in Version | EMPTY => |
2011-09-05 09:18 |
|
Target Version | => 6.5.2 |
2011-09-05 09:18 |
|
Description Updated | |
2011-09-13 09:33 |
|
Note Added: 0018106 | |
2011-09-13 09:33 |
|
Priority | normal => high |
2011-09-13 12:48 | kgv | Note Added: 0018115 | |
2011-09-13 12:48 | kgv | Status | assigned => resolved |
2011-09-13 12:48 | kgv | Assigned To | kgv => abv |
2011-09-13 13:06 |
|
Note Added: 0018116 | |
2011-09-13 13:30 | kgv | Note Added: 0018118 | |
2011-09-13 13:39 |
|
Note Added: 0018119 | |
2011-09-13 13:39 |
|
Status | resolved => reviewed |
2011-09-15 12:48 |
|
Note Added: 0018160 | |
2011-09-15 12:49 |
|
Assigned To | abv => kgv |
2011-09-15 12:49 |
|
Status | reviewed => assigned |
2011-09-21 09:41 | kgv | Assigned To | kgv => mkv |
2011-09-21 09:41 | kgv | Status | assigned => reviewed |
2011-09-21 09:44 | kgv | Assigned To | mkv => kgv |
2011-09-21 11:08 | kgv | Assigned To | kgv => apl |
2011-09-21 11:15 | kgv | Note Added: 0018236 | |
2011-09-22 18:13 |
|
Assigned To | apl => kgv |
2011-09-22 18:15 |
|
Note Added: 0018268 | |
2011-09-23 11:13 |
|
Status | reviewed => assigned |
2011-09-26 10:29 | kgv | Note Added: 0018275 | |
2011-09-26 10:30 | kgv | File Added: chl_928_V8_mmgtopt0.txt | |
2011-09-26 10:31 | kgv | Note Edited: 0018275 | |
2011-09-27 11:47 | kgv | Relationship added | related to 0022734 |
2011-09-27 11:48 | kgv | Note Edited: 0018275 | |
2011-12-26 11:25 |
|
Relationship added | related to 0022819 |
2011-12-26 14:28 |
|
Note Added: 0019002 | |
2011-12-26 14:28 |
|
Status | assigned => resolved |
2011-12-26 14:56 | kgv | Note Added: 0019003 | |
2011-12-26 15:12 |
|
Note Added: 0019004 | |
2011-12-26 15:18 | kgv | Note Added: 0019006 | |
2011-12-26 15:18 | kgv | Status | resolved => reviewed |
2011-12-26 20:18 |
|
File Added: LP2-TestMemAlloc.xls | |
2011-12-26 20:25 |
|
Note Added: 0019009 | |
2011-12-28 20:08 |
|
Note Added: 0019042 | |
2011-12-28 20:08 |
|
Status | reviewed => assigned |
2011-12-29 12:05 |
|
Assigned To | kgv => skv |
2011-12-29 12:05 |
|
Note Added: 0019044 | |
2012-01-23 12:19 |
|
Assigned To | skv => kgv |
2012-02-20 16:04 |
|
Status | assigned => resolved |
2012-02-20 16:05 |
|
Note Added: 0019670 | |
2012-02-20 16:15 |
|
Status | resolved => reviewed |
2012-02-20 17:16 |
|
Assigned To | kgv => aan |
2012-02-23 18:21 |
|
Note Added: 0019757 | |
2012-02-23 18:22 |
|
Note Edited: 0019757 | |
2012-02-23 18:22 |
|
Note Edited: 0019757 | |
2012-02-23 18:24 |
|
Note Edited: 0019757 | |
2012-02-23 18:26 |
|
Note Added: 0019758 | |
2012-02-23 18:27 |
|
Assigned To | aan => kgv |
2012-02-23 18:27 |
|
Status | reviewed => assigned |
2012-02-24 10:16 | kgv | Note Added: 0019770 | |
2012-02-24 14:11 | kgv | Assigned To | kgv => dbv |
2012-03-21 11:14 |
|
Note Added: 0020050 | |
2012-03-21 11:14 |
|
Assigned To | dbv => vro |
2012-03-21 12:27 | vro | Assigned To | vro => kgv |
2012-03-21 12:29 | vro | Note Added: 0020056 | |
2012-03-21 12:36 | vro | Note Added: 0020058 | |
2012-03-21 12:37 |
|
Status | assigned => resolved |
2012-03-21 12:38 |
|
Note Added: 0020059 | |
2012-03-21 12:38 |
|
Status | resolved => reviewed |
2012-03-21 12:38 |
|
Status | reviewed => tested |
2012-03-21 12:40 |
|
Relationship added | related to 0023032 |
2012-03-21 12:41 |
|
Note Edited: 0020059 | |
2012-03-21 14:05 |
|
Note Edited: 0020059 | |
2012-03-21 18:20 | apn | Note Added: 0020076 | |
2012-03-22 11:01 | bugmaster | Target Version | 6.5.2 => 6.5.3 |
2012-03-22 11:09 | bugmaster | Note Added: 0020087 | |
2012-03-22 11:09 | bugmaster | Status | tested => verified |
2012-03-22 11:09 | bugmaster | Resolution | open => fixed |
2012-03-29 17:26 | bugmaster | Changeset attached | => occt master af09dbff |
2013-05-24 12:37 | kgv | Relationship added | related to 0023988 |