drumnkyle / KSCardView

A robust, customizable, easy to use, subclass of UIView for iOS.
MIT License
108 stars 10 forks source link

Memory leaks #6

Open hadu610 opened 9 years ago

hadu610 commented 9 years ago

Hi, thank you for making such an awesome control. While playing with it, I thought I found an issue with memory. if you try to add a good amount of cards or just make them loop circularly, you will see the memory keep increasing when it presents a new card. I'm currently trying to fix this bug, but have found out yet. Please help me to fix this issue if you think it's legit. Otherwise, let me know any hint that you can think of.

Thanks a lot.

drumnkyle commented 9 years ago

Thanks for reporting this. I'm not sure if there as an issue or not. Can you please give me a little more detail as to the exact situation you are seeing this in? I'm not sure what you mean by "make them loop circularly". Also, are you testing this in the simulator or on a device? You will not get accurate memory usage details from the simulator. You need to test on the device to get accurate memory usage details, and if you could use instruments to show where the memory issue may be, that would be very helpful. I don't imagine that this would be a problem, but if you can give me some more data it would be helpful. Otherwise, I will need to try and reproduce it and I may not get to it until later this week or this weekend.

Thanks.

hadu610 commented 9 years ago

Thanks for your quick reply. "make them loop circularly" means present the first card after the last card. In this control, first card is showed, then you swipe it to get the second card. When you swipe the last card instead of showing an alert "No More Card", just show the first card again. (card #1 --> card #2 -->card #3 --> card #1 -->card #2 ... and so on like a circular LinkList). With this, you can see the memory keep increasing.

Or, for an easy way to reproduce this issue, just add plenty of cards (1000 cards maybe) and keep swiping in one direction, you will see the memory keep increasing as well.

I tested both on device (iphone 5, ios 8) and simulator as well. I hope I didn't report this wrong. If I did, please accept my apology.

Thanks.

drumnkyle commented 9 years ago

Sorry for taking so long to look into this. I don't see anything that looks suspicious when I run it. If it were a memory leak, I should see the memory increasing or never going down. One reason you may think this is because any overlays you set are set statically so that they exist for every card, so when you remove a card, the memory won't go down by as much because it will not be removing the overlay images. If you are seeing the memory increasing without decreasing, let me know exactly how you are reproducing this. Otherwise, I don't believe there is an issue.