469,580 Members | 1,992 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,580 developers. It's quick & easy.

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 1993
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by qushui_chen | last post: by
reply views Thread by Dave Harris | last post: by
2 posts views Thread by Bob C. | last post: by
6 posts views Thread by Stephen Costanzo | last post: by
2 posts views Thread by Michael Maes | last post: by
6 posts views Thread by henrycortezwu | last post: by
2 posts views Thread by =?Utf-8?B?S2VuTg==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.