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

FlexboxLayoutManager will throw OOM if Adapter's item count is too many. #374

Open
1 task done
eneim opened this issue Nov 9, 2017 · 1 comment
Open
1 task done
Labels

Comments

@eneim
Copy link

eneim commented Nov 9, 2017

Issues and steps to reproduce

FlexboxLayoutManager will throw OOM if number of item is too many. To reproduce this, simply return Integer.MAX_VALUE from Adapter.

I could see that you save a cache of Measure spec/size in an array of long whose size is depended on number of Item multiple by 2. This is the root cause, but I don't know the mindset behind the use of this Array, so I could not put any effort to fix this at the moment. Removing or Changing the use of this Array could break the FlexboxLayout too.

Expected behavior

From my investigating with other built-in LayoutManager, Integer.MAX_VALUE would not crash any of them. I expect FlexboxLayoutManager could be like this too.

Version of the flexbox library

Latest: 0.3.1

Link to code

N/A

@thagikura thagikura added the bug label Nov 10, 2017
@thagikura
Copy link
Contributor

Thanks for filing this. The reason why measured results are cached is to reuse the same calculation logic for flexbox for both FlexboxLayout and FlexboxLayoutManager.
An individual view from FlexboxLayoutManager isn't retrieved in the same way as FlexboxLayout during calculation.

Anyway I'll have a look if that allocation can be reduced.

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

No branches or pull requests

2 participants