Re: Memory used by a UIImage?

2011-03-07 Thread David Duncan
On Mar 4, 2011, at 8:17 PM, Rick Mann wrote:

 Unfortunately, if I create the image from a PNG, it's possible iOS stores it 
 compressed, and only decompresses when rendering. I'd like to know how much 
 it's using at any given moment.


If you create the UIImage with the withContentsOfFile APIs, then we'll 
reference the file for image data when necessary and may or may not be loaded 
into memory (generally it won't be). If you use the withData APIs, then the 
compressed data is always in memory. Using the withCGImage APIs will depend 
on how you created the CGImage itself.

But if you are trying to figure out your memory usage, it is better to use the 
VM Tracker instrument (part of the Allocations template). You'll have to turn 
on automatic sampling or press the sample button yourself to get data, but 
watching the Dirty Size statistic is what you are interested in here.
--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory used by a UIImage?

2011-03-04 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 3/4/11 2:18 PM, Rick Mann wrote:
 Is there a way to determine how much memory a given UIImage is using for the 
 in-memory image data?

Shot in the dark: access its CGImage to get the the underlying
CGImageRef, then use the CGImage functions to calculate the size?

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNcW3uaOlrz5+0JdURAlrtAJ9osY3/iIOgdYECfub4qOkKmTXjywCeKhPh
pNLs+rj6AnOY0dQ7bT/xuDI=
=SPV4
-END PGP SIGNATURE-
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory used by a UIImage?

2011-03-04 Thread Steve Christensen
I doubt you could find out *exactly* how much memory is being used. You could 
probably get an approximation by multiplying pixelHeight * pixelWidth * 4 
(assuming A, R, G, B channels), since the image bitmap is likely to be the 
biggest chunk for images of any real size.


On Mar 4, 2011, at 2:18 PM, Rick Mann wrote:

 Is there a way to determine how much memory a given UIImage is using for the 
 in-memory image data?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory used by a UIImage?

2011-03-04 Thread Rick Mann
Unfortunately, if I create the image from a PNG, it's possible iOS stores it 
compressed, and only decompresses when rendering. I'd like to know how much 
it's using at any given moment.

Thanks, though.

-- 
Rick

On Mar 4, 2011, at 20:14:26, Steve Christensen wrote:

 I doubt you could find out *exactly* how much memory is being used. You could 
 probably get an approximation by multiplying pixelHeight * pixelWidth * 4 
 (assuming A, R, G, B channels), since the image bitmap is likely to be the 
 biggest chunk for images of any real size.
 
 
 On Mar 4, 2011, at 2:18 PM, Rick Mann wrote:
 
 Is there a way to determine how much memory a given UIImage is using for the 
 in-memory image data?
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com