Hi Romain, > I don't know what you're doing with the Camera but a picture coming > from the Camera uses several MB of memory so...
In part for this reason I normally use the camera preview mode, which on the T-Mobile G1 takes only 3 * 480 * 320 / 2 ~= 230 KB per image, so no memory problem there, and even when expanding this into an integer pixel array for further image processing it would still be a manageable 480 * 320 * 4 ~= 614 KB. However, for my purposes I need only 64 x 64 pixel views, such that sub-sampling during YUV411 decoding and prior to further image processing keeps the extra memory use (on top of G1's hard-coded 230 KB preview data) far below this 614 KB (namely just 64 * 64 * 4 ~= 16 KB). The uncompressed still images from takePicture() are indeed several MB by default because of G1's 2048 * 1536 pixel snapshots, or about 6 MB when mapping to an RGB_565 bitmap. In fact it is one of the still unanswered questions which still image resolutions are supported by the G1. There is of course the heap-devouring 2048 * 1536, and experimentally it was determined that 480 * 320 also works (I tested that yesterday together with another developer who has a G1), but we have no comprehensive and authoritative list of supported resolutions to make proper trade-offs with memory use, while Android (SDK 1.0 r1) has no API for querying the camera about supported resolutions. The latter makes that Android-based camera applications cannot be made future-proof for when other Android phones with other cameras hit the market. I find this a serious concern as I have expressed on multiple occasions. Thank you for your further explanation about the internals of Drawable. I cannot be sure if my getting rid of using Drawable was indeed the reason that all my heap problems vanished, but your explanation further encourages me not to touch it with a stick unless I fully understand what I am doing - or what Android is doing. :-) Peter On Nov 15, 8:10 pm, Romain Guy <[EMAIL PROTECTED]> wrote: > I don't know what you're doing with the Camera but a picture coming > from the Camera uses several MB of memory so... > > One issue with Drawable is that they have a Callback pointer to a > View. That means if you keep your Drawable in a static field (directly > or indirectly), you forever keep a reference to a View. And that View > has a reference to the Context (your Activity), which has references > to all the widgets and resources on the current screen. That makes it > very easy to blow up the heap :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

