You Are Here:

Community: Developer Discussion Boards

#1 Old Image.CreateImage() hungry of memory! - 2007-01-11, 13:59

Join Date: Oct 2005
Posts: 19
kimi007
Offline
Registered User
Hello

I'm using an HTTP connection to get an array of bytes, in order to generate and Image later. But when I create the image I detect that nearly 80Kb of RAM goes off! My images are PNG files of about 3Kb. So I don't know where that memory goes. The main problem is that I cannot recover that memory using GC and my app crashed.

I'm doing this..

c = (HttpConnection) Connector.open(URL);
is = c.openDataInputStream();
int len = (int)c.getLength();
if (len > 0)
{
data = new byte[len];
is.readFully(data);
image = Image.createImage(data, 0, data.length); // Here is the problem
data = null;
}

What I'm doing wrong? Thanks!
Kimi
Reply With Quote

#2 Old Re: Image.CreateImage() hungry of memory! - 2007-01-11, 14:12

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
Quote:
Originally Posted by kimi007
But when I create the image I detect that nearly 80Kb of RAM goes off! My images are PNG files of about 3Kb. So I don't know where that memory goes.
The memory taken by a loaded image != the size of the png file.

In the png file all the data is compressed. When you load the image (on most - if not all - implementations) it is "opened" up into a device-dependent bitmap so it can be drawn fast enough. The memory consumption is normally the resolution of the image multiplied by the color depth of the screen (plus a small constant for the image header).

shmoove
Reply With Quote

#3 Old Re: Image.CreateImage() hungry of memory! - 2007-01-11, 16:31

Join Date: Mar 2005
Posts: 499
Location: Paris
njzk2
Offline
Regular Contributor
precisely.
say you have a 140x140 image, it requires 140x140x4 bytes to be created, which is : 78400 bytes.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
CAknForm/CAknDialog and memory management ValentinK General Symbian C++ 0 2006-07-10 21:16
7650 and 3650 Canvas and FullCanvas memory marcilgen Mobile Java General 5 2003-07-08 13:24
Some memory related and other issues sanjg2k1 General Discussion 0 2003-07-07 18:38
can not successfully link any sample using .NET lobotomat Symbian Tools & SDKs 2 2002-08-20 01:29
9210 and 9210i java memory allams Mobile Java General 0 1970-01-01 02:00

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia