If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] GUI app runs fast and then slows down

Hey

Program: Downloads thumbnails from photobucket.com galleries and displays them in ListView controls on the main form.
there is a ListView for each gallery that is downloaded. each gallery is chosen by a TabControl
also there is a second form that has a ListBox on it that lists the url's for download

My problem is that the GUI in my program works fine and all the thumbnails are added to the ListView pretty much instantly after its been downloaded. after a few galleries have been downloaded. the process of adding the thumbnails to the ListView is noticeably slow. even tho the thumbnails are already downloaded.

i am using threads in this program.
The main thread which is for the gui of the main form.
the 2nd form is running on its own thread.
a specified amount of threads are started to download images that are inserted in to a download queue (at the moment this is 10)
a thread is also added to add the images to the ListViews (this was an attempt to fix this problem and better then the previous way of adding the images)

the process
main thread:
link to gallery
-> download the gallery and extract the links to the thumbnails
-> each thumbnail link is inserted in to the download queue

downloadqueue thread:
loops till there is a link in the queue
-> downloads the thumbnail
-> the thumbnail image is inserted in to a List<> which holds information about the thumbnail

addtolistview thread:
loops till there is a thumbnail in the List<>
-> creates a Bitmap of the image data
-> using .Invoke adds the Bitmap to a ImageList on the main form
-> using .Invoke adds an item to the ListView linking to the correct image

as i said it works nicely to start off with and then gradually the performance slows

Re: GUI app runs fast and then slows down

it doesnt actually download the thumbnails to the disk it creates a Bitmap using a Byte[] dynamically
it does use fair amount of memory ive seen it at about 160MB
as far as i can tell its not paging the memory ...
the cpu is at about 65% for my dual core
is there an easy way to check for a memory link
thanks boudino

Re: GUI app runs fast and then slows down

ok i think ive fixed it...
but what i did was to create a new ImageList for each Tab.
i think it was going slow because there would be over 1000-2000+ images in the one ImageList and i was using a String key to link it to the thumbnail that was added to the ListView
Thank You for your Help