我很好奇以下代码是否会泄漏…
data = getBitmapdataFromCameraCallback();//this is immutable, so...
//make a mutable copy...
originalUserPhoto = BitmapFactory.decodeByteArray(data, 0, data.length).copy(Config.ARGB_8888, true);
Matrix matrix = new Matrix();
// -1 doesn't reverse it for some oddball reason, so, we get REALLY close to -1
matrix.preScale(-0.999f, 1.0f);//don't ask don't tell
originalUserPhoto = Bitmap.createBitmap(originalUserPhoto, 0, 0,
originalUserPhoto.getWidth(), originalUserPhoto.getHeight(),
matrix, true);
如果我在原地修改originalUserPhoto(请注意我将其作为createBitmap的源参数传递),那么这样会泄露原始数据吗?或者JVM足够智能以释放原来存在的数据?
static
成员引起的,这意味着它将永久存在。 - EboMike