-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Should release mColors in recycle? #46
Comments
What do you mean by releasing? mColors is a Java variable so it is released automagically by GC. Only memory allocated at native (C) level should be explicitly released which happens in recycle() method. |
Hi, koral. I have made two experimental projects to explain this problem. My experimental environment:
GifExperimentWithoutRecylemColorsThe android-gif-drawable in GifExperimentWithoutRecylemColors didn't change any file. And app crashed when I click
It seems like that mColors has not been recycled by VM. GifExperimentWithRecylemColorsIn this project, I just change the declaration of mColors and set mColors to null recycle() method GifDrawable.java
.....
protected int[] mColors;
.....
public void recycle() {
mColors = null;
mIsRunning = false;
int tmpPtr = mGifInfoPtr;
mGifInfoPtr = 0;
free(tmpPtr);
} Run the app, click on
mColors have been released by VM and Activity2 starts successfully. |
OK, I see that explict releasing |
It seems like that mColors has not been recycled by VM...
The text was updated successfully, but these errors were encountered: