J
Jeff
I've been working on an application for a while now that has been giving
me some trouble when it comes to working with a picturebox and memory
usage. My company deals with digital imaging, so we are dealing with
high resolution images (2500x3300pixels.)
The application allows the user to browse through the images in a
directory to find the images they need (files listed in a listbox,
clicking on the item displays it in a picturebox.) The problem is that
memory usage just keeps climbing and climbing as the user browses
through the images.
The program will start around with about 24MB of usage. But after
viewing about a dozen images, it will have doubled to around 50MB. This
number will just keep on climbing as more images are viewed.
I've tried loading the image two ways
1.
picImage.Image = Image.FromFile(filename)
and the second way which I saw a post about using to resolve memory leaks
2.
Dim _image As Image
_image = Image.FromFile(filename)
picImage.Image = _image
They both end up with the same results. The only way I have found that
keeps the memory from skyrocketing is to call GC.Collect() at the end of
the function that loads the images, which is supposed to be one of the
most evil things you can do in most situations.
Anyone have any ideas? I don't want to have to call GC.Collect() since
everyone says how horrible it is, but it's the only reliable way I've
found to keep the memory down (the machines running the application will
be Win98 machines with only 256MB of RAM for a while at least, so I'd
like to keep the memory usage down.)
Thanks,
Jeff
me some trouble when it comes to working with a picturebox and memory
usage. My company deals with digital imaging, so we are dealing with
high resolution images (2500x3300pixels.)
The application allows the user to browse through the images in a
directory to find the images they need (files listed in a listbox,
clicking on the item displays it in a picturebox.) The problem is that
memory usage just keeps climbing and climbing as the user browses
through the images.
The program will start around with about 24MB of usage. But after
viewing about a dozen images, it will have doubled to around 50MB. This
number will just keep on climbing as more images are viewed.
I've tried loading the image two ways
1.
picImage.Image = Image.FromFile(filename)
and the second way which I saw a post about using to resolve memory leaks
2.
Dim _image As Image
_image = Image.FromFile(filename)
picImage.Image = _image
They both end up with the same results. The only way I have found that
keeps the memory from skyrocketing is to call GC.Collect() at the end of
the function that loads the images, which is supposed to be one of the
most evil things you can do in most situations.
Anyone have any ideas? I don't want to have to call GC.Collect() since
everyone says how horrible it is, but it's the only reliable way I've
found to keep the memory down (the machines running the application will
be Win98 machines with only 256MB of RAM for a while at least, so I'd
like to keep the memory usage down.)
Thanks,
Jeff