-
Notifications
You must be signed in to change notification settings - Fork 121
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 warning when scroll the photo #36
Comments
In my app I have got the same situation. Is there a way I can track which images are loaded and which should be removed from memory? I have seen methods loadPhoto and unLoadPhoto, but that not seems to release memory. I have done tests in Instruments and it looks like when new image gets loaded memory from images which should be released is still taken. Any help for this situation would be appreciated. |
I have same problem.For this problem, it's "reuse"..... in KTPhotoScrollViewController.m
In SDImageCache.m Find [memCache setObject:image forKey:key]; if (memArray.count > 3) { ..... remeber remove object in memCache
} |
BonnyLin, have you tried : if the photos have a large resolution? |
In my project, every photo was more than 1.5MB, but almost 2.0MB(like urs.) So i reuse KTPhotoView for 3 views(Performance not bad...huh)...and clear cache. I think maybe your problem is too many PhotoView in photoarray. |
Thanks, it sounds great and I'll try it~ But I still want to know : |
|
So here: [photoViews_ replaceObjectAtIndex:index withObject:[NSNull null]]; it will cause the the currentPhotoView to be released once, right? I understand it like this:
SO in unload: when currentPhotoView is removed, only photoViews_ retains it. Am I wrong? |
U can add function in KTPhotoView.m call -(void)releaseall and then set imageView_->image = nil and others.. Original code: 3x level1 => 3x maybe i use wrong way to release memory...so i use my stupid way to resolve my problem...haha ^_^||| Hope can help u.[photoViews_ replaceObjectAtIndex:index withObject:photoView]; photoViews_ will more and more... then replace by [NSNull null].... "the object that as released won't actually be freed unless the retain count goes to 0" because we use NSMutableArray and give it a capacity count, U can use "Xcode Profile" to listen, will find the memory change. I use "alloc" to check my code.. |
How about this memory issue. I also have this problem. The issue is: when I browse the large photo slowly, the memory will increase and also be down to low level. But If quickly browse the large photo, the memory will increase quickly and receive the low memory and then crash. http://stackoverflow.com/questions/11462878/iphone-memory-heap-increase-for-uiimage |
@yanfangjin I believe this lib is mainly for the small-size photos as UIImageView simply is not suitable for showing large-size image. |
@scorpiozj yes. I have check this issue many times, but I can not fixed the memory increase issue. Did you have some solution to resolve the large-size image browse and view project, such as the native gallery? |
@yanfangjin in my opinion, resize the large image. In the native photo app, the photo is also resized. If you import a large image from iPhoto to iPhoto,you will see the image is compressed to a suitable size (you can send the photo from iPhone to test it). If you want to show originally large one, you should see CALayer. |
@scorpiozj , actuarially, I only use the max photo size is 1600*1200. But I will decode from the 8M photo from captured image in iPhone4S. Is there any sample code about the CALayer for large image browser? |
@yanfangjin ,yes you can search in developer.apple.com. there are several samples |
I touch the thumbnail to see the photo, and I scroll left/right.
After several times (about 10), it receives memory warning.
Continue to scroll and it crashes.
My photo is about 2M+ and has a size of 1600*2400 or so on.
I notice there is handle for memory in SDImageCache.m, but it seems that it doesn't work.
The text was updated successfully, but these errors were encountered: