473,554 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ImageList - Memory-Issue in vs2005

Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael

Apr 27 '06 #1
2 1348
I am not noticing a real issue on my machine. Other than the resource files
are huge and there is a load time (~30 secs) while loading the imagelist's
stream. It seems to be just as fast to populate the images collection from
bitmaps on the harddrive. Perhaps you can alter your solution so that you
are not embedding the graphics in the exe.

Here is my test, given a form, place a checkbox, a numeric updown box, a
picturebox, and three imagelists on the form. To generate the 900 images,
uncomment the code in Form1_Load (Make sure you comment after the first run
so that #1 load times are not affected, #2 the application doesn't crash
trying to save the bitmap to disk.)

Once you have the images, add the 900 images to imagelist1 and imagelist2.
imagelist3 will load them from bmps on the drive.

System Spec's Dell 2.8GHz, 1GB RAM. I should note that I have several
office docs open, three VS IDE's open, virus scan, media player, outlook,
outlook express, and two windows explorer windows.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

For i As Integer = 1 To 900
' Dim bmp As Bitmap

' bmp = New Bitmap(16, 16,
System.Drawing. Imaging.PixelFo rmat.Format32bp pRgb)

' For x As Integer = 0 To 15
' For y As Integer = 0 To 15
' bmp.SetPixel(x, y,
System.Drawing. Color.FromArgb( CInt(Int((Integ er.MaxValue - 1 + 1) * Rnd() +
1))))
' Next
' Next

' Me.ImageList2.I mages.Add(i.ToS tring, bmp)
' bmp.Save(String .Format("C:\Pic tures\temp\{0}. bmp", i))
' 'bmp.Dispose()

Dim sFile As String
sFile = String.Format(" C:\Pictures\tem p\{0}.bmp", i)
Me.ImageList3.I mages.Add(i, New Bitmap(sFile))
Next

Me.NumericUpDow n1.Minimum = 0
Me.NumericUpDow n1.Maximum = Me.ImageList3.I mages.Count - 1
Me.NumericUpDow n1.DecimalPlace s = 0

End Sub

Private Sub NumericUpDown1_ ValueChanged(By Val sender As System.Object,
ByVal e As System.EventArg s) Handles NumericUpDown1. ValueChanged

Dim g As System.Drawing. Graphics

g = Me.PictureBox1. CreateGraphics
g.Clear(Color.B lack)

If CheckBox1.Check ed Then
Try
g.DrawImage( _
Me.ImageList3.I mages(CType(Me. NumericUpDown1. Value, Integer)),
0, 0)
Catch ex As Exception
'
End Try
Else
Try
g.DrawImage( _
Me.ImageList2.I mages(CType(Me. NumericUpDown1. Value, Integer)),
0, 0)
Catch ex As Exception
'
End Try
End If

End Sub
"Michael Maes" <mi**********@c ommunity.nospam > wrote in message
news:C0******** *************** ***********@mic rosoft.com...
Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not
work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael

Apr 27 '06 #2
You are correct about the closing of the project and re-opening though. My
IDE, crashed when I reopened the file, and that was after 10 min with very
little available resources. Wow. I would recommend a seperate resource
file or reading the bmp's directly from disk.
"AMDRIT" <am****@hotmail .com> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
I am not noticing a real issue on my machine. Other than the resource
files are huge and there is a load time (~30 secs) while loading the
imagelist's stream. It seems to be just as fast to populate the images
collection from bitmaps on the harddrive. Perhaps you can alter your
solution so that you are not embedding the graphics in the exe.

Here is my test, given a form, place a checkbox, a numeric updown box, a
picturebox, and three imagelists on the form. To generate the 900 images,
uncomment the code in Form1_Load (Make sure you comment after the first
run so that #1 load times are not affected, #2 the application doesn't
crash trying to save the bitmap to disk.)

Once you have the images, add the 900 images to imagelist1 and imagelist2.
imagelist3 will load them from bmps on the drive.

System Spec's Dell 2.8GHz, 1GB RAM. I should note that I have several
office docs open, three VS IDE's open, virus scan, media player, outlook,
outlook express, and two windows explorer windows.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

For i As Integer = 1 To 900
' Dim bmp As Bitmap

' bmp = New Bitmap(16, 16,
System.Drawing. Imaging.PixelFo rmat.Format32bp pRgb)

' For x As Integer = 0 To 15
' For y As Integer = 0 To 15
' bmp.SetPixel(x, y,
System.Drawing. Color.FromArgb( CInt(Int((Integ er.MaxValue - 1 + 1) * Rnd()
+ 1))))
' Next
' Next

' Me.ImageList2.I mages.Add(i.ToS tring, bmp)
' bmp.Save(String .Format("C:\Pic tures\temp\{0}. bmp", i))
' 'bmp.Dispose()

Dim sFile As String
sFile = String.Format(" C:\Pictures\tem p\{0}.bmp", i)
Me.ImageList3.I mages.Add(i, New Bitmap(sFile))
Next

Me.NumericUpDow n1.Minimum = 0
Me.NumericUpDow n1.Maximum = Me.ImageList3.I mages.Count - 1
Me.NumericUpDow n1.DecimalPlace s = 0

End Sub

Private Sub NumericUpDown1_ ValueChanged(By Val sender As System.Object,
ByVal e As System.EventArg s) Handles NumericUpDown1. ValueChanged

Dim g As System.Drawing. Graphics

g = Me.PictureBox1. CreateGraphics
g.Clear(Color.B lack)

If CheckBox1.Check ed Then
Try
g.DrawImage( _
Me.ImageList3.I mages(CType(Me. NumericUpDown1. Value,
Integer)), 0, 0)
Catch ex As Exception
'
End Try
Else
Try
g.DrawImage( _
Me.ImageList2.I mages(CType(Me. NumericUpDown1. Value,
Integer)), 0, 0)
Catch ex As Exception
'
End Try
End If

End Sub
"Michael Maes" <mi**********@c ommunity.nospam > wrote in message
news:C0******** *************** ***********@mic rosoft.com...
Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not
work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael


Apr 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2629
by: qushui_chen | last post by:
How can i let ImageList control contain Image in use show the Image really size. I see the ImageList have set ex:Size(255,255);
0
1274
by: Dave Harris | last post by:
We have a piece of code located in an unmanged C++ function that is currently bleeding a GDI each time it is run. We have tried numerous things, each with its own problems. We made pImageList a static (and threw it in a gcroot) and commented out the dispose because the system would crash or hang after a few hundered iterations (we could...
0
1735
by: Bruno Zarokian | last post by:
Is it possible to put RGBA bitmaps in an ImageList with the designer ? I'm trying to put some PNG bitmaps with alpha in an ImageList with the designer, but it seems to convert the bitmaps in BMP w/o Alpha in the resx binary stream : when I reopen the ImageList image collection in the designer, the bitmaps are no more from a "PNG source" but...
2
8511
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control...
2
2083
by: copyco | last post by:
I've got an application where I have an animated image in a picturebox. A timer event changes the image by assigning an image from an imagelist to it. I've found that the code for this is causing the application to use more and more memory until it craps out. If I comment the code out, it's fine. Can anyone tell me if there is a way I can...
0
2227
by: Chris Putnam | last post by:
I am working on an application that includes a feature where a directory is spidered and thumbnails are displayed. I have it pretty much down, but when the bitmaps are loaded from file, memory is hogged like crazy. I know this is where the memory problems occur because I've gone through that whole comment/check the ram thing. Here's the...
6
1407
by: Stephen Costanzo | last post by:
In the code below I receive an exception error because the target file is being used by another process. I know this to be false because the target doesn't exist. It seems like the application believes that the file is still in use by the application. My concern is that I do not think that I still have a reference to it. In the removeImage...
4
4316
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and ImageList24 (for 24x24). I have inserted images in each and it has worked fine for months... The System.Drawing.Bitmap properties for these images are...
4
2186
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code: Win32.Shell.SHGetFileInfo(NodePath, 256, fileinfo, cbFileInfo, flags) tvFolders.ImageList.Images.Add(Icon.FromHandle(fileinfo.hIcon)) tn.ImageIndex = tvFolders.ImageList.Images.Count...
2
3548
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and was causing memory spikes. After several hours we discovered that the ImageList.Images indexer is actually returning a copy of the added Images...
0
7603
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7806
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7891
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5439
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5159
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3553
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2021
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1139
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.