PC Review


Reply
Thread Tools Rate Thread

Bitmap image load chews up a lot of memory

 
 
=?Utf-8?B?QXNo?=
Guest
Posts: n/a
 
      5th Jul 2004
Hi,

There seems to be a memory leak problem in loading an image in .NET

I am trying to load up an image, which is 1MB in size on the disk. When I load up the image it expands out to atleast 25MB in memory. THIS cannot be right!!

The line of code I am using is:

"formImage = new Bitmap("Form.jpg");"

Does anyone know a fix around this?? Please help.

 
Reply With Quote
 
 
 
 
Ed Kaim [MSFT]
Guest
Posts: n/a
 
      5th Jul 2004
JPG images are compressed, but when an image is loaded in an app it needs to
allocate the memory required for the pixel data. For example, I took a
screenshot of my desktop (a 24-bit image at 1400x1050) and saved it as a
jpg, which resulted in a 51KB file. However, when I open it in Paint, the
memory required to keep the image in memory is 3 x 1400 x 1050 = 4.5MB. For
some reason Paint actually ends up using 18MB, but I guess that's a topic
for another thread :-)

"Ash" <(E-Mail Removed)> wrote in message
news:FB494DA4-F61A-42BE-98A9-(E-Mail Removed)...
> Hi,
>
> There seems to be a memory leak problem in loading an image in .NET
>
> I am trying to load up an image, which is 1MB in size on the disk. When I
> load up the image it expands out to atleast 25MB in memory. THIS cannot be
> right!!
>
> The line of code I am using is:
>
> "formImage = new Bitmap("Form.jpg");"
>
> Does anyone know a fix around this?? Please help.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load image from file using Bitmap class =?Utf-8?B?S2V2ZW4gQ29yYXp6YQ==?= Microsoft Dot NET Compact Framework 0 6th Jun 2005 12:28 PM
New Bitmap causes chews up a lot of memory =?Utf-8?B?QXNo?= Microsoft Dot NET Framework Forms 3 6th Jul 2004 06:10 AM
Painting image chews lot of memory =?Utf-8?B?QXNo?= Microsoft Dot NET Framework 1 6th Jul 2004 05:27 AM
cannot load bitmap into memory jeff24b Windows XP Basics 1 24th Oct 2003 04:03 PM
Re: HELP!!! How to load Tiff image with ISO-JPEG compressing to .NET Bitmap class Bob Powell [MVP] Microsoft Dot NET 1 10th Jul 2003 11:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:15 AM.