20-09-2008, 08:58 AM
I just got a out of memory error on this line of code
That code is located in:
And WriteBytes are called from a timer with the interval 3 for some reason:
As I said, Out of Memory. And would like to know what could be the possible cause of it. For some reason, this is eating up all my RAM, of course my computer hasn't been restared in like 3-5days and only have 700+RAM on my server computer. But I don't think this should happen anyway. I remember talking with verr about the interval on the timer. It should be low but we couldn't decide how low really. I guess I will attempt to change it to 10-15ms.
Code:
Call mvarSocket.Write(dbytes, thenShutdown)
Code:
Public Sub WriteBytes(dbytes() As Byte, Optional thenShutdown As Boolean)
Call mvarSocket.Write(dbytes, thenShutdown)
End Sub
And WriteBytes are called from a timer with the interval 3 for some reason:
Code:
Private Sub Timer1_Timer()
Dim i As Integer
Dim TmpStr As String
Dim dbytes() As Byte
For i = 1 To MAX_PLAYERS
TmpStr = vbNullString
With ConQueues(i)
If Not .Lock Then
On Error Resume Next
If GameServer.Sockets(i).Socket Is Nothing Then
.Lines = vbNullString
End If
If Len(.Lines) = 0 And QueueDisconnect(i) = True Then
Call CloseSocket(i)
QueueDisconnect(i) = False
Else
If Len(.Lines) > 0 Then
If Len(.Lines) < MAX_PACKETLEN Then
TmpStr = .Lines
Else
TmpStr = Left$(.Lines, MAX_PACKETLEN)
End If
.Lines = Right$(.Lines, Len(.Lines) - Len(TmpStr))
End If
End If
If Len(TmpStr) > 0 Then
dbytes = StrConv(TmpStr, vbFromUnicode)
If IsConnected(i) Then
GameServer.Sockets(i).WriteBytes dbytes
DoEvents
End If
End If
End If
End With
Next
DoEvents
End Sub