473,394 Members | 1,149 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ImageList is using up memory

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 manage the memory better? Is there better code for this or
something? Why is it using up memory? Any help is appreciated. The
code below is what I have within my timer event which fires once per
second...

imageIndex += 1
If imageIndex > 11 Then
imageIndex = 0
End If
If cmiShowAnimation.Checked Then
pboAnimation.Image = ilsAnimation.Images(imageIndex)
End If

Nov 20 '05 #1
2 2081
That must not be that code that is causing problems, I let it run for some
time and I saw nothing wierd with memory - it did go up and down, but only
in a 1mb range (which to be expected). What else are you doing in the loop?
What type of images are you using in the ImageList? What OS / Framework /
VStudio versions?

~
Jeremy

"copyco" <co****@anon.com> wrote in message
news:Hu***************@newssvr22.news.prodigy.com. ..
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 manage the memory better? Is there better code for this or
something? Why is it using up memory? Any help is appreciated. The
code below is what I have within my timer event which fires once per
second...

imageIndex += 1
If imageIndex > 11 Then
imageIndex = 0
End If
If cmiShowAnimation.Checked Then
pboAnimation.Image = ilsAnimation.Images(imageIndex)
End If


Nov 20 '05 #2
The image types are 32 x 32 images of a clock icon that I have that
animates the hands moving around. The OS I'm using is Win 2000
Professional. The Framework is 1.0, Visual Studio ver. 7.0.9466.

I actually think it has more to do with the fact that when the form is
minimized, the amount of memory allocated decreases automatically. But
I don't know much about this, so I don't really know. I use a
NotifyIcon in the taskbar and I make the main for invisible when
minimized. The MouseDown event on the NotifyIcon brings the form back
to Normal and Visible. I have the NotifyIcon change icons every second
(with the timer event) in a certain situation to alert the user of an
event. I think this has something to do with the problem. All of this
works for several hours, but after a while, the MouseDown event on the
NotifyIcon doesn't respond, and the NotifyIcon isn't changing it's icon,
even though the app is supposed to be doing that. However, log file
entries continue to report that the app is still functioning, but it is
just unresponsive to outside user input with the NotifyIcon. The
Windows Task Manager says it's using up all the memory. I'll have to
poke around with it some more I guess. Thanks for the help.
Jeremy Cowles wrote:
That must not be that code that is causing problems, I let it run for some
time and I saw nothing wierd with memory - it did go up and down, but only
in a 1mb range (which to be expected). What else are you doing in the loop?
What type of images are you using in the ImageList? What OS / Framework /
VStudio versions?

~
Jeremy

"copyco" <co****@anon.com> wrote in message
news:Hu***************@newssvr22.news.prodigy.com. ..
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 manage the memory better? Is there better code for this or
something? Why is it using up memory? Any help is appreciated. The
code below is what I have within my timer event which fires once per
second...

imageIndex += 1
If imageIndex > 11 Then
imageIndex = 0
End If
If cmiShowAnimation.Checked Then
pboAnimation.Image = ilsAnimation.Images(imageIndex)
End If


Nov 20 '05 #3

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

Similar topics

1
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
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...
2
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to display the thumbnail of size more then 256x256 in...
2
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...
0
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...
6
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...
2
by: Michael Maes | last post by:
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...
6
by: henrycortezwu | last post by:
Hi, I have a WinXPSP2, P4 3.2GHZ, 1GIG RAM on my dev machine using VS2005 VB.NET. I did the following procedure: 1. Added 82 icons (128x128 in size & 32bit Depth) in an imagelist control 2....
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.