java - Avoid OutOfMemory when creating an image -


i want create bufferedimage in java-application. users allowed change dimensions of image , allow images "as big possible". how can check, whether creating bufferedimage cause outofmemory-exception , recover it?

use runtime.getruntime().freememory() check free memory of jvm instance. , based on value can add restrictions dimensions future image.


Comments

Popular posts from this blog

c# - Farseer ContactListener is not working -

Automatically create pages in phpfox -

database - one php page with different contents and urls -