Author |
Message |
Rodrigo Sandova #1 / 4
|
 Bug with PictureBox
I don't know if this is a bug, created a little App with a picturebox control and a timer, each time the timer fires it's only event the app randomizes a number, after getting that number, builds the path where i have some jpg's pictures, and the loads a picture according to the number the app gets. The bug (I think) is, after loading the image, the app uses 1.2 Mb of RAM added to the 13.7 Mb that already used, again, the app fires the timer event and the picturebox image property is set to nothing, but this doesnt relases the memory used, and when the new picture is loaded the app uses 1.2 Mb more of memory, if this goes on and on the app uses too much memory, if you want
Please let me know if this a bug, or this is the way it is supposed to work
|
Mon, 23 Aug 2004 07:56:47 GMT |
|
 |
Mike #2 / 4
|
 Bug with PictureBox
It's probably a bug, but with your code rather than the PictureBox (or VB). Instead of setting the Image property to Nothing, try the following instead: Picture1.Picture = LoadPicture() Mike
I don't know if this is a bug, created a little App with a picturebox control and a timer, each time the timer fires it's only event the app randomizes a number, after getting that number, builds the path where i have some jpg's pictures, and the loads a picture according to the number the app gets. The bug (I think) is, after loading the image, the app uses 1.2 Mb of RAM added to the 13.7 Mb that already used, again, the app fires the timer event and the picturebox image property is set to nothing, but this doesnt relases the memory used, and when the new picture is loaded the app uses 1.2 Mb more of memory, if this goes on and on the app uses too much memory, if you want
Please let me know if this a bug, or this is the way it is supposed to work
|
Mon, 23 Aug 2004 21:17:00 GMT |
|
 |
Jim Deutc #3 / 4
|
 Bug with PictureBox
It is indeed a bug. You haven't said which version of VB you are using, nor which service pack. Nor do I know which of those exhibits this bug or whether any version is free of it. You can easily work around it in your case, though, because the bug is when you set the image property to nothing. There is no reason to do that in this case. Just load the next picture and I believe your problem will be over. IIRC, memory leaks (in some versions/service packs) when you do Picture1.cls or Set Picture1.Picture = Nothing but not if you do Picture1.Line (0, 0) - Step(Picture1.ScaleWidth, Picture1.ScaleHeight), Picture1.BackColor, BF Jim Deutch MS Dev MVP
I don't know if this is a bug, created a little App with a picturebox control and a timer, each time the timer fires it's only event the app randomizes a number, after getting that number, builds the path where i have some jpg's pictures, and the loads a picture according to the number the app gets. The bug (I think) is, after loading the image, the app uses 1.2 Mb of RAM added to the 13.7 Mb that already used, again, the app fires the timer event and the picturebox image property is set to nothing, but this doesnt relases the memory used, and when the new picture is loaded the app uses 1.2 Mb more of memory, if this goes on and on the app uses too much memory, if you want
Please let me know if this a bug, or this is the way it is supposed to work
|
Tue, 24 Aug 2004 01:07:10 GMT |
|
 |
Rodrigo Sandova #4 / 4
|
 Bug with PictureBox
Yes, I forgot the version... sorry I'm using Visual Basic .NET RSV Quote: >-----Original Message----- >It is indeed a bug. You haven't said which version of
VB you are using, nor Quote: >which service pack. Nor do I know which of those
exhibits this bug or Quote: >whether any version is free of it. You can easily work around it in your >case, though, because the bug is when you set the image
property to nothing. Quote: >There is no reason to do that in this case. Just load
the next picture and Quote: >I believe your problem will be over. >IIRC, memory leaks (in some versions/service packs) when you do >Picture1.cls or >Set Picture1.Picture = Nothing >but not if you do >Picture1.Line (0, 0) - Step(Picture1.ScaleWidth,
Picture1.ScaleHeight), Quote: >Picture1.BackColor, BF >Jim Deutch >MS Dev MVP
message
>I don't know if this is a bug, created a little App with >a picturebox control and a timer, each time the timer >fires it's only event the app randomizes a number, after >getting that number, builds the path where i have some >jpg's pictures, and the loads a picture according to the >number the app gets. >The bug (I think) is, after loading the image, the app >uses 1.2 Mb of RAM added to the 13.7 Mb that already >used, again, the app fires the timer event and the >picturebox image property is set to nothing, but this >doesnt relases the memory used, and when the new picture >is loaded the app uses 1.2 Mb more of memory, if this >goes on and on the app uses too much memory, if you want
>Please let me know if this a bug, or this is the way it >is supposed to work >.
|
Wed, 25 Aug 2004 00:12:31 GMT |
|
|
|