Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap的分析与使用 关于recycle()的描述有误 #49

Open
hqzxzwb opened this issue Feb 4, 2017 · 0 comments
Open

Bitmap的分析与使用 关于recycle()的描述有误 #49

hqzxzwb opened this issue Feb 4, 2017 · 0 comments

Comments

@hqzxzwb
Copy link

hqzxzwb commented Feb 4, 2017

虽然recycle()方法可以提前释放Bitmap占用的内存,但是不调用recycle()并不会造成内存泄漏。此方法的文档如下,注意最后一句:
Free the native object associated with this bitmap, and clear the reference to the pixel data. This will not free the pixel data synchronously; it simply allows it to be garbage collected if there are no other references. The bitmap is marked as "dead", meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed, so it should only be called if you are sure there are no further uses for the bitmap. This is an advanced call, and normally need not be called, since the normal GC process will free up this memory when there are no more references to this bitmap.
https://developer.android.com/reference/android/graphics/Bitmap.html#recycle()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant