long aMb = 1024 * 1024;
bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED;
double aLimitedMemory = myCache->GetLimitedMemory();
- double aLimitedMemoryMax = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+ double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+ double anUsedMemory = myCache->GetMemorySize();
+ double aLimitedMemoryMax = std::max(anUsedMemory + aFreeMemory, aLimitedMemory);
// Settings
QButtonGroup* aMemoryGroup = new QButtonGroup( 2, Qt::Vertical, tr( "MEMORY_MODE" ), this );
myMimimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aMemoryGroup );
myMimimalMemoryButton->setChecked( !isLimitedMemory );
- myLimitedMemory = new QtxDblSpinBox( 1.0, std::max( aLimitedMemory, aLimitedMemoryMax ), 10.0, aMemoryGroup );
+ myLimitedMemory = new QtxDblSpinBox( 1.0, aLimitedMemoryMax, 10.0, aMemoryGroup );
myLimitedMemory->setSuffix( " Mb" );
myLimitedMemory->setValue( aLimitedMemory );
myLimitedMemory->setEnabled( isLimitedMemory );
QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup );
myUsedMemory = new QLineEdit( aStateGroup );
- myUsedMemory->setText( QString::number( (double)myCache->GetMemorySize() ) + " Mb" );
+ myUsedMemory->setText( QString::number( anUsedMemory ) + " Mb" );
myUsedMemory->setReadOnly( true );
myUsedMemory->setEnabled( false );
myUsedMemory->setPaletteForegroundColor( Qt::black );
QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE" ), aStateGroup );
myFreeMemory = new QLineEdit( aStateGroup );
- myFreeMemory->setText( QString::number( aLimitedMemoryMax ) + " Mb" );
+ myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" );
myFreeMemory->setReadOnly( true );
myFreeMemory->setEnabled( false );
myFreeMemory->setPaletteForegroundColor( Qt::black );