-
June 3rd, 2009, 01:24 AM
#1
[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
any help will be appreciated
thank you in advance
-
June 3rd, 2009, 03:00 AM
#2
Re: GUI app runs fast and then slows down
How much memory doest the application consume? Maybe there is a memory leak which forces OS to swap. What¨s disk activity? Does it significantly increase?
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
June 3rd, 2009, 06:13 AM
#3
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
-
June 3rd, 2009, 09:42 PM
#4
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|