mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-21 03:39:40 +05:00
warn the user that the application may crash if not enough memory remains
This commit is contained in:
parent
b83db6830f
commit
580a459516
@ -373,34 +373,31 @@ namespace SMESH
|
|||||||
|
|
||||||
if ( objModified ) {
|
if ( objModified ) {
|
||||||
// PAL16631. Mesurements showed that to show aVisualObj in SHADING(default) mode,
|
// PAL16631. Mesurements showed that to show aVisualObj in SHADING(default) mode,
|
||||||
// ~10 times more memory is used than it occupies.
|
// ~5 times more memory is used than it occupies.
|
||||||
// Warn the user if there is less free memory than 30 sizes of a grid
|
// Warn the user if there is less free memory than 30 sizes of a grid
|
||||||
// TODO: estimate memory usage in other modes and take current mode into account
|
// TODO: estimate memory usage in other modes and take current mode into account
|
||||||
int freeMB = SMDS_Mesh::CheckMemory(true);
|
int freeMB = SMDS_Mesh::CheckMemory(true);
|
||||||
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
|
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
|
||||||
if ( freeMB > 0 && usedMB * 30 > freeMB ) {
|
cout << "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB<<endl;
|
||||||
#ifdef _DEBUG_
|
if ( freeMB > 0 && usedMB * 5 > freeMB ) {
|
||||||
MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB
|
bool continu = false;
|
||||||
<< ", usedMB=" << usedMB );
|
if ( usedMB * 3 > freeMB )
|
||||||
#endif
|
// even dont try to show
|
||||||
// bool continu = false;
|
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
||||||
// if ( usedMB * 10 > freeMB )
|
QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
||||||
// // even dont try to show
|
else
|
||||||
// SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
// there is a chance to succeed
|
||||||
// QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
continu = SUIT_MessageBox::warning
|
||||||
// else
|
(SMESHGUI::desktop(),
|
||||||
// // there is a chance to succeed
|
QObject::tr("SMESH_WRN_WARNING"),
|
||||||
// continu = SUIT_MessageBox::warning
|
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
||||||
// (SMESHGUI::desktop(),
|
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
||||||
// QObject::tr("SMESH_WRN_WARNING"),
|
SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
||||||
// QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
if ( !continu ) {
|
||||||
// SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
// remove the corresponding actors from all views
|
||||||
// SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
RemoveVisualObjectWithActors( theEntry );
|
||||||
// if ( !continu ) {
|
aVisualObj.reset();
|
||||||
// // remove the corresponding actors from all views
|
}
|
||||||
// RemoveVisualObjectWithActors( theEntry );
|
|
||||||
// aVisualObj.reset();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user