izyumkin / MCEmojiPicker

👻 EmojiPicker. Emoji picker for iOS like on macOS. With SwiftUI support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leaks

maree91 opened this issue · comments

Great library but the memory leaks makes it unusable with over 400MB memory usage sometimes that persist even after deallocating multiple parent VCs. I think displaying each emoji in a single UILabel might not be the best way to do it.

I haven't achieved that much memory consumption, but yes, it's a big problem. For which, unfortunately, I still haven't found a solution. Even using the CoreText does not solve the problem.

The only working solution I have found is to display the emoji as a UIImage, this does not lead to such a large memory consumption.

If you have any ideas or suggestions on how to fix this, I will be glad.

What about presenting the view controller with a scroll view.

On the bottom is a horizontal stack view representing the categories. Then on the scroll view you present a list of imageviewes vertically where each imageview represent an emoji category in a single image containing all the emojis related to the category. And when ever the user taps you detect the location of the particular emoji in place then either present the skin tone options or just dismiss the picker and get the selection.
You may also make a table view/ collection view for easier layout of the imageviews.

I am thinking outloud here and haven't thought it through really.

Interesting suggestion, I will be glad to see your contribution.

I want to still try to figure out how using UILabel you can display emoji without compromising memory. Since this is a global problem in Swift, it would be interesting to solve it and simplify the development of thousands of other developers.

In the current version, the library is still usable, since you will not be able to find analogues without this problem.

If the app back to background, the memory will be deallocated.