// called to free the memory used with the dispached or removed event void AHFilter::freeEventMemory(unsigned int size){ pthread_mutex_lock(&usedMem); unsigned usedMemory = getUsedMemory() - size; assert(usedMemory >= 0 ); setUsedMemory(usedMemory); pthread_mutex_unlock(&usedMem); }
void MainWindow::displayMemoryStatus() { QMessageBox msgBox; msgBox.setText("Διαθέσιμη μνήμη : " + QString::number(round(getAvailableMemory())) + " Megabyte\n" + "Μνήμη σε χρήση : " + QString::number(round(getUsedMemory())) + " Megabyte \n" + "Μέγιστη μνήμη : " + QString::number(memoryForMaryServer) + " Megabyte"); msgBox.setIcon( QMessageBox::Information ); msgBox.exec(); }
void ofxMemoryUsage::update(){ int secs = (int)(ofGetElapsedTimeMillis()/1000)%60; if(updateSecs != secs){ updateSecs = secs; memory_total = getTotalMemory(); memory_used_total = getUsedMemory(); memory_used_process = getProcessMemory(); } }
// function called before add events to a list, because // we have to verify the available memory bool AHFilter::tryAllocateEventMemory(unsigned int size){ bool returnValue = true; pthread_mutex_lock(&usedMem); unsigned used = getUsedMemory(); // it means that we have if(( used - size) >= 0){ setUsedMemory((used - size)); }else{ returnValue = false; } pthread_mutex_unlock(&usedMem); return returnValue; }