|
-
May 9th, 2007, 02:03 AM
#1
computer sluggish after application
I am writing an application that searches data and writes it to a text file. All this is done through looping, many times through 150,000 data items.
After the application ends my computer becomes sluggish and stays that way. I have tweaked the registry to "AlwaysUnloadDlls", thinking the dlls used by the application is hanging around to long. this has not worked. Anyone have any ideas to stop the sluggishness?
-
May 9th, 2007, 03:01 AM
#2
Re: computer sluggish after application
Try to open Task Manager and check if the application is still inside the running processes. Also try check if your file size is too excessive.
++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
God does not play dice with the universe.(A.Einstein)
-
May 9th, 2007, 03:41 AM
#3
Re: computer sluggish after application
The file size ends up 12 megabites. But that's outside the application.
-
May 9th, 2007, 03:59 AM
#4
Re: computer sluggish after application
And what about the CPU usage in task manager? You can also sort your processes by CPU in the task list. What process is slowing your PC?
++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
God does not play dice with the universe.(A.Einstein)
-
May 9th, 2007, 04:22 PM
#5
Re: computer sluggish after application
Also as a iterest sake.. how are you terminating the application.. are you wrapping up all the Dll's properly, and exiting in a orderly fasion... (not with a END statement..
Gremmy..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
May 9th, 2007, 09:55 PM
#6
Re: computer sluggish after application
Andrea Rossini was on the right track (file size). It wasn't the physical file size but the the string array size I was using to access the file. Since the file was changing during a looping, I didn't know the string array size so I was doing a lot of redimming. Example under option explicit I used:
Dim strA()
Dim a as long
I used Redim strA(a) everytime a changed. This is what created the sluggishness after I closed the program. So I changed to
Dim strA(800000)
since strA could get quite large, but not 800000 large, but wanted to see if it would accept a large array. It did and I didn't need to Redim. Not only did the sluggishness stop, but the loop speeded up from taking nearly four and a half minutes to complete, to taking 30 seconds.
It's amazing how on this furom you may not get the exact answer, but someone has a suggestion that leads to an answer. Thanks everyone
-
May 10th, 2007, 08:46 AM
#7
Re: computer sluggish after application
That's great... Glad you got a problem sorted, but what still gets me a little confused, is why when the application ended, the sluggishness remained. After all when the app exit's it realeases all memory used, including memory from all the redimmed variables...
In essence when a application terminates it should leave the system in exactly the same state as before it started (Excluding system Services applications).. It is obvious that your application is leaving a residule effect behind, which it shouldn't.. (and i'm not talking about files written to the HDD)..
In all honesty you've found something to increase the efficiency of the application, Including memory usage, but you have not found out why you have a residule effect...
I'd still look ito why the application is not terminating properly, as this may cause problems in future..
Gremmy...
Last edited by GremlinSA; May 10th, 2007 at 08:48 AM.
Reason: typo's
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
May 10th, 2007, 10:18 AM
#8
Re: computer sluggish after application
It makes sense not to redim constantly, as VB creates TWO string copies when you REDIM a string.
I agree with Gremmy, that you have a memory leak. That should be the first thing to fix.
Generally it's good to step thru your exit routine to see what is and isn't closing.
-
May 11th, 2007, 11:37 AM
#9
Re: computer sluggish after application
Seems like everything is unloading, but I do have at unload the freelibrary
function. This is because my program has a related document .res file that allows me to have xp visual styles with vb6 and needs to be freed at unload or I get an error message. Wonder if this is the problem. How does one check for memory leak anyways.
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
|