public static long getEstimatedMemoryUsage ( Raster raster ) { // we assume that the data buffer stores each element in a byte-rounded memory element; // maybe the buffer is smarter about things than this, but we're better to err on the safe // side DataBuffer db = raster . getDataBuffer ( ) ; int bpe = ( int ) Math . ceil ( DataBuffer . getDataTypeSize ( db . getDataType ( ) ) / 8f ) ; return bpe * db . getSize ( ) ; }
Returns the estimated memory usage in bytes for the specified raster .