-
Notifications
You must be signed in to change notification settings - Fork 379
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
UICollectionView memory issues #271
Comments
Awesome dude, I'll check it out! |
I'll ping you here so you get notified when it's fixed @sajib-ghoshInnofied |
I made some optimization. But it's hard for me to see if it makes a difference, even when profiling, on my iPhone XS running iOS 14. Could any of you try out commit 974c3fc and compare if it improves things? @sajib-ghoshInnofied @AlphaSanets |
Hi,
Thanks for the quick response.
I checked your changes but unfortunately the performance issue is still
there. It consumes more than 1 GB when the list is huge. And the app
*crashed* due to lack of memory.
*Connection to assetsd was interrupted - assetsd exited, died, or closed
the photo library*
Message from debugger: Terminated due to memory issue
I have attached a screenshot, please check it out.
Also, after these changes it failed to decode some of the images. It's a
new issue.
*[ImageManager] [RM]: 2-1678-1 Failed to decode image*
*2020-07-17 20:06:30.504220+0530 Gallery[2568:1021359] [Unknown process
name] CGBitmapContextInfoCreate: unable to allocate 28656640 bytes for
bitmap data*
Could you please check what's going on here.
Thanks
[image: Screen Shot 2020-07-17 at 8.04.39 PM.png]
…On Fri, Jul 17, 2020 at 7:04 PM Joakim Gyllström ***@***.***> wrote:
I made some optimization. But it's hard for me to see if it makes a
difference, even when profiling, on my iPhone XS running iOS 14.
Sure it consumes 200-300mb of memory when quickly scrolling through tens
of thousands of photos but it never becomes a problems as there is lots or
free memory.
Could any of you try out commit 974c3fc
<974c3fc>
and compare if it improves things?
@sajib-ghoshInnofied <https://github.com/sajib-ghoshInnofied> @AlphaSanets
<https://github.com/AlphaSanets>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSPYDPIE4WCA2OC4WSNLR4BHNDANCNFSM4N3IOY4A>
.
--
Sajib Ghosh
Software Engineer
Innofied Solution Pvt. Ltd. | <http://www.innofied.com/>www.innofied.com
Phone: 8017105232 | 033 40081324
NASSCOM Member
Social: Facebook <https://www.facebook.com/innofied> | Twitter
<https://twitter.com/innofied> | LinkedIn
<https://www.linkedin.com/company/innofied-solution-pvt-ltd-> | Google+
<https://plus.google.com/+Innofied>
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Hmm. I'm scrolling through 40 000 images (with icloud photos enabled) on my iPhone XS running iOS 14 using the example app included in this repo with zero issues. How many images are you scrolling through? |
Hi,
1. There are about 500 images but there are many videos also.
2. I am using iPhoneX
3. iOS version - 13.5.1
4. Yes have done below customization is *fetchResults* ,
let settings = imagePicker.settings
settings.fetch.album.fetchResults = [
PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumUserLibrary, options: options),
PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumFavorites, options: options),
PHAssetCollection.fetchAssetCollections(with: .album, subtype: .
albumRegular, options: options),
PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumSelfPortraits, options: options),
PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumPanoramas, options: options),
PHAssetCollection.fetchAssetCollections(with: .smartAlbum,
subtype: .smartAlbumVideos, options: options),
]
Thanks
…On Fri, Jul 17, 2020 at 8:34 PM Joakim Gyllström ***@***.***> wrote:
Hmm. I'm scrolling through 40 000 images (with icloud storage enabled) on
my iPhone XS running iOS 14 using the example app included in this repo
with zero issues.
How many images are you scrolling through?
What device are you using?
Which iOS version is it running?
Have you done any customization/settings on the image picker? Fetch
request, fetch options, cell size, etc?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSPYVJKJKWGOPLVOZ3WLR4BSA5ANCNFSM4N3IOY4A>
.
--
Sajib Ghosh
Software Engineer
Innofied Solution Pvt. Ltd. | <http://www.innofied.com/>www.innofied.com
Phone: 8017105232 | 033 40081324
NASSCOM Member
Social: Facebook <https://www.facebook.com/innofied> | Twitter
<https://twitter.com/innofied> | LinkedIn
<https://www.linkedin.com/company/innofied-solution-pvt-ltd-> | Google+
<https://plus.google.com/+Innofied>
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
It looks like you are using your own fetch options too? |
Yes. I am using my own options. But even if I change the fetchResults from
Settings itself, the result is the same.
Another thing I noticed is that if I close the image picker then it
consumes the same amount of memory when it was open. Any quick solution for
this?
Again, thanks for your quick response.
…On Fri, Jul 17, 2020 at 9:18 PM Joakim Gyllström ***@***.***> wrote:
It looks like you are using your own fetch options too?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSP6IE3VFOHY3WZ3XCVDR4BXGJANCNFSM4N3IOY4A>
.
--
Sajib Ghosh
Software Engineer
Innofied Solution Pvt. Ltd. | <http://www.innofied.com/>www.innofied.com
Phone: 8017105232 | 033 40081324
NASSCOM Member
Social: Facebook <https://www.facebook.com/innofied> | Twitter
<https://twitter.com/innofied> | LinkedIn
<https://www.linkedin.com/company/innofied-solution-pvt-ltd-> | Google+
<https://plus.google.com/+Innofied>
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Still works for me. I'll see if I can dust of an old device running iOS 12 and reproduce it. Can you clone this repo, checkout the branch feature/performance_optimization and run the example app on your device?
|
Hi,
I have run your example app from feature/performance_optimization branch.
Unfortunately still facing the same issue. Maybe this is a device specific
issue?
I think there is some memory leak happening. Could you please look into
this?
I am attaching the screenshots.
[image: Screen Shot 2020-07-17 at 10.03.59 PM.png]
[image: Screen Shot 2020-07-17 at 10.04.20 PM.png]
…On Fri, Jul 17, 2020 at 9:51 PM Joakim Gyllström ***@***.***> wrote:
Still works for me. I'll see if I can dust of an old device running iOS 12
and reproduce it.
Can you clone this repo, checkout the branch
feature/performance_optimization and run the example app on your device?
That is what I'm testing with - so we are testing the same app and can
rule out that there is something else wrong.
git clone ***@***.***:mikaoj/BSImagePicker.git
cd BSImagePicker
git checkout feature/performance_optimization
open BSImagePicker.xcworkspace
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSP54KDY7LDV2OHHIKYTR4B3APANCNFSM4N3IOY4A>
.
--
Sajib Ghosh
Software Engineer
Innofied Solution Pvt. Ltd. | <http://www.innofied.com/>www.innofied.com
Phone: 8017105232 | 033 40081324
NASSCOM Member
Social: Facebook <https://www.facebook.com/innofied> | Twitter
<https://twitter.com/innofied> | LinkedIn
<https://www.linkedin.com/company/innofied-solution-pvt-ltd-> | Google+
<https://plus.google.com/+Innofied>
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Using the memory graph tool, I also observed that the ImagePickerController is never getting deallocated from memory even after dismiss is called. Tried to look into the implementation a bit and found a few places that weak self was not referenced in closure and tried to fix those but still not fixing the issue. |
Thanks for looking into this. Yes, please resolve this issue when you can
since this is a serious issue.
Also, please look into the 'out of memory' issue.
I think, it will be the best image picker library for iOS if the memory
issue is resolved since this highly customisable.
Thanks
…On Sat 18 Jul, 2020, 4:12 AM Michelle Yin, ***@***.***> wrote:
Re "I think there is some memory leak happening.".
Using the memory graph tool, I also observed that the
ImagePickerController is never getting deallocated from memory even after
dismiss is called. Tried to look into the implementation a bit and found a
few places that weak self was not referenced in closure and tried to fix
those but still not fixing the issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSP3L3DXYUA7FLZ6YWYDR4DHWHANCNFSM4N3IOY4A>
.
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Hi,
Did you get a chance to look into this issue?
Please let me know once you look at it since this is urgent.
Thank you
On Sat, Jul 18, 2020 at 12:04 PM Sajib Ghosh <[email protected]>
wrote:
… Thanks for looking into this. Yes, please resolve this issue when you can
since this is a serious issue.
Also, please look into the 'out of memory' issue.
I think, it will be the best image picker library for iOS if the memory
issue is resolved since this highly customisable.
Thanks
On Sat 18 Jul, 2020, 4:12 AM Michelle Yin, ***@***.***>
wrote:
> Re "I think there is some memory leak happening.".
>
> Using the memory graph tool, I also observed that the
> ImagePickerController is never getting deallocated from memory even after
> dismiss is called. Tried to look into the implementation a bit and found a
> few places that weak self was not referenced in closure and tried to fix
> those but still not fixing the issue.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#271 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADYYSP3L3DXYUA7FLZ6YWYDR4DHWHANCNFSM4N3IOY4A>
> .
>
--
Sajib Ghosh
Software Engineer
Innofied Solution Pvt. Ltd. | <http://www.innofied.com/>www.innofied.com
Phone: 8017105232 | 033 40081324
NASSCOM Member
Social: Facebook <https://www.facebook.com/innofied> | Twitter
<https://twitter.com/innofied> | LinkedIn
<https://www.linkedin.com/company/innofied-solution-pvt-ltd-> | Google+
<https://plus.google.com/+Innofied>
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Sort of, I started looking at it and could see high memory usage and sluggish performance on an older device running iOS 12.4. Interestingly it was independent of photos (assets) loading/fetching/viewing but happens even when using vanilla UICollectionViewCells with no asset fetching. But that is something I'll continue looking into whenever I get the time. The second issue you are mentioning that ImagePickerController isn't deallocated I'm not seeing at all on either device or iOS version. If that is indeed the case I'm guessing that you are keeping a strong reference to it in your code otherwise I'll probably need to see some actual code that can reproduce it. Also as you seem to be replying using mail, note that none of your attached screenshot can be seen in this issue. Just an FYI :) |
Thanks for looking into it.
Please keep me posted about the progress of the same.
…On Tue 21 Jul, 2020, 6:12 PM Joakim Gyllström, ***@***.***> wrote:
Sort of, I started looking at it and could see high memory usage and
sluggish performance on an older device running iOS 12.4. Interestingly it
was independent of photos (assets) loading/fetching/viewing but happens
even when using vanilla UICollectionViewCells with no asset fetching. But
that is something I'll continue looking into whenever I get the time.
The second issue you are mentioning that ImagePickerController isn't
deallocated I'm not seeing at all on either device or iOS version. If that
is indeed the case I'm guessing that you are keeping a strong reference to
it in your code otherwise I'll probably need to see some actual code that
can reproduce it.
Also as your seem to be replying using mail, note that none of your
attached screenshot can be seen in this issue. Just an FYI :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYYSPYJGXVPGTIYUOH2D53R4WEK3ANCNFSM4N3IOY4A>
.
--
NOTICE: This message is intended only for the individual to whom it is
addressed and may contain information that is confidential or privileged.
If you are not the intended recipient, or the employee or person
responsible for delivering it to the intended recipient, you are hereby
notified that any dissemination, distribution, copying or use is strictly
prohibited. If you have received this communication in error, please notify
the sender and destroy or delete this communication immediately.
|
Hi @mikaoj , Did you manage to get time to look into this (High memory issue) issue for older iOS version. This works perfectly for iOS 13.5.1. I think the problem lies in the older version. Thanks. |
@michelleyin96 were you able to determine if your app was causing the leak? I'm seeing the same issue of ImagePickerController not being deallocated after dismiss. I have combed through my code but can't find the source of the leak. |
Take a look at my comment here and check if it helps to mitigate the problem. |
If we have a lot of high resolution pictures in the photos, present ImagePickerController and scroll fast - memory usage goes up to 500 MB and even cause crash.
Occurred on IPhone 6+ (iOS 12.4.7).
On iPhone XR (iOS 13.5.1) doing the same steps did not occurred the crash but I noticed very high CPU usage (even more than on iPhone 6+). Maybe with the new version of iOS Apple changed work with UICollectionView or PHAsset objects.
Anyway I think it would be nice to implement some sort of cache for UICollectionView.
Possible solutions: here and here.
The text was updated successfully, but these errors were encountered: