Re: Cycling between images increases memory usage
From: Scytrax (anonymous_at_discussions.microsoft.com)
Date: 05/09/04
- Next message: Herfried K. Wagner [MVP]: "Re: Cycling between images increases memory usage"
- Previous message: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- In reply to: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Next in thread: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Reply: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 9 May 2004 04:01:05 -0700
Hi Bob.
I read your faq recently and realized the importance of disposing images. That handled another problem I was having in the same application. Thanks.
However, when cycling images in the picture box, I cannot dispose of the image because I keep looping through the images and so I need all images to be displayed more than once.
I do something like the following (pseudo code):
int counter = 0;
Image images[] = new Image[5];
images[0] = Image.FromFile("image1");
images[1] = Image.FromFile("image1");
images[2] = Image.FromFile("image1");
images[3] = Image.FromFile("image1");
images[4] = Image.FromFile("image1");
this.Timer1.Start();
onTimerTick:
this.PictureBox1.Image = this.images[counter++];
if(counter == this.images.Length)counter = 0;
In theory, this should not cause any memory problems, right?
I have been testing my program again during the night and after running app. 6 hours, I only had an increase of about 200K. So maybe I don't have a problem anymore. However, I would still like a confirmation that the general procedure as described above should not cause any memory problems.
Thanks for being a great help to your fellow coders, Bob!
Anders
- Next message: Herfried K. Wagner [MVP]: "Re: Cycling between images increases memory usage"
- Previous message: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- In reply to: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Next in thread: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Reply: Bob Powell [MVP]: "Re: Cycling between images increases memory usage"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|