-
Program slows down and eventually stops.
I have a VB program that is processing 700,000 + records.
I put in some code that writes the current time to an
output file and noticed that the program processes the
first few 1000 records fine. But eventually processing
begins to slow down and than stops. I have check for
looping and have no idea what else could be causing this
or how to continue debugging. I'm using VB 6 in an
NT environment.
Would some point me the right direction.
Thanks in advance for any help.
James
-
Re: Program slows down and eventually stops.
James,
Sounds like you have a MAJOR Memory Leak somewhere in your code.
Arthur Wood
"James" <tbt102@hotmail.com> wrote:
>
>I have a VB program that is processing 700,000 + records.
>I put in some code that writes the current time to an
>output file and noticed that the program processes the
>first few 1000 records fine. But eventually processing
>begins to slow down and than stops. I have check for
>looping and have no idea what else could be causing this
>or how to continue debugging. I'm using VB 6 in an
>NT environment.
>
>Would some point me the right direction.
>
>Thanks in advance for any help.
>
>James
>
-
Re: Program slows down and eventually stops.
Are you using Excel in any way?
I had a similar problem while sorting
10000+ files and make kind of an index in
Excel. After the first 500- 1000 entries it
went slower an slower and eventually the
system crashed. Really sounds like a memory
leak but my code was doublececked by two
differnt persons who weren't able to figure
this problem out either... I don't know, a bug?
Urs
-
Re: Program slows down and eventually stops.
"James" <tbt102@hotmail.com> wrote:
>
>I have a VB program that is processing 700,000 + records.
>I put in some code that writes the current time to an
>output file and noticed that the program processes the
>first few 1000 records fine. But eventually processing
>begins to slow down and than stops. I have check for
>looping and have no idea what else could be causing this
>or how to continue debugging. I'm using VB 6 in an
>NT environment.
>
Are you concatenating any big strings?
For example:
dim i as long
dim s as string
for i = 0 to 100000
s = s & "abc"
if (i mod 1000) = 0 then
debug.print time
end if
next
This will get slower and slower and eventually appear to stop (though it
is still running). The problem here is that when you are concatinating to
a very large string, the time for a single operation gets longer and longer.
The workaround is to create a variable dimension array and create the big
string in blocks of 1000 loops then concatinating the array back into a single
string, e.g.:
Dim i As Long
Dim s As String
Dim strArr() As String
Dim SizeOfStrArrInt As Integer
For i = 0 To 100000
's = s & "abc"
If (i Mod 1000) = 0 Then
ReDim Preserve strArr(SizeOfStrArrInt)
SizeOfStrArrInt = SizeOfStrArrInt + 1
Debug.Print Time
End If
strArr(SizeOfStrArrInt - 1) = strArr(SizeOfStrArrInt - 1) & "abc"
Next
For i = 0 To SizeOfStrArrInt - 1
'put it back together from the pieces
s = s & strArr(i)
Next
Debug.Print s
Hope this helps,
<Patrick>
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|