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

Memory Leaks #43

Open
niteshkhatri opened this issue Nov 13, 2015 · 3 comments
Open

Memory Leaks #43

niteshkhatri opened this issue Nov 13, 2015 · 3 comments

Comments

@niteshkhatri
Copy link

Hi, First of all thanks for such a great piece of code. I am using your code in one of my project.

I have a Fragment A, here I click on a button and go to Fragment B. In Fragment B, I have EmojiView button to show and hide PopupWindow.

When I was in Fragment A, 13MB of memory was being utilised. After I moved to Fragment B and clicked on EmojiView button to show EmojiView, the memory graph goes upto 20 MB. Now when I come back from Fragment B to Fragment A then the memory graph still shows 20 MB after GC. The memory is not getting released.

Please help me out. Is there any View that might not be released?

@niteshkhatri
Copy link
Author

Hey, I found the issue but don't know how to fix it. Inside the PopupWindow class I have added GlobalLayoutListener on the view. This listener is holding the reference. Because of this the instance of Fragment B is not getting released. When I run the code without GlobalLayoutListener, the instance of Fragment B is released from memory.

in the onStop() of Fragment B is have removing the GlobalLayoutListener of the PopupWindow but still the instance is not released.

This is what I wrote in onStop() of Fragment B:

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        mLayout.getViewTreeObserver().removeGlobalOnLayoutListener(mGlobalLayoutListener);
    } else {
        mLayout.getViewTreeObserver().removeOnGlobalLayoutListener(mGlobalLayoutListener);
    }

@rafa19
Copy link

rafa19 commented Dec 4, 2015

I have the same Memory Leak error. Did you solve it?

@rafa19
Copy link

rafa19 commented Dec 7, 2015

I solved my problem.it was because of i put large image for emoji button

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

2 participants