i want to print how much memory is occupying by a image when that particular image is loaded. can anyone have idea? Please help me Thank You Lakshmi
UIImage
provides no obvious way of telling the memory of the underlying data. However we could use Core Graphics to give us the estimate. You could probably get an estimate of the memory occupied by an image by doing
size_t imageSize = CGImageGetBytesPerRow(image.CGImage) * CGImageGetHeight(image.CGImage);
But I suggest you don't base any image management on this. You really don't know how much memory you will have with you. Try to minimize how many images you've loaded into memory. Basically, optimize as necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With