| Mirage Source http://miragesource.net/forums/ |
|
| clsSocket verrs System http://miragesource.net/forums/viewtopic.php?f=201&t=4384 |
Page 1 of 1 |
| Author: | William [ Sat Sep 20, 2008 8:58 am ] |
| Post subject: | clsSocket verrs System |
I just got a out of memory error on this line of code Code: Call mvarSocket.Write(dbytes, thenShutdown) That code is located in: 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 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. |
|
| Author: | JokeofWeek [ Sat Sep 20, 2008 1:04 pm ] |
| Post subject: | Re: clsSocket verrs System |
You have a memory leak somewhere. Memory leaks can be caused by loads of things, so you might want to check your source for any obvious ones. One possible memory leak which I just found out the other day is exiting a sub/function while you are still in a with statement, for example : Code: With Map x=.x y=.y exit sub end with Another tip would be to download a code profiler (such as this one : http://www.aivosto.com/project/project.html). However, many of these are expensive, so good luck finding a free one. I don't remember if CodeSMART finds memory leaks, if it does, you can use that |
|
| Author: | William [ Sat Sep 20, 2008 1:07 pm ] |
| Post subject: | Re: clsSocket verrs System |
Hum, I guess I need to do this.. *boring* |
|
| Author: | JokeofWeek [ Sat Sep 20, 2008 1:11 pm ] |
| Post subject: | Re: clsSocket verrs System |
William wrote: Hum, I guess I need to do this.. *boring* Aha yeah, it's definitely boring looking for memory leaks. I just checked out CodeSMART and it does give you some memory leaks, so you can try that if you want, might save you lots of time |
|
| Author: | William [ Sat Sep 20, 2008 2:30 pm ] |
| Post subject: | Re: clsSocket verrs System |
Im not gonna let CodeSmart fuck up my code by changing things. Can that really be trusted? |
|
| Author: | William [ Sat Sep 20, 2008 4:09 pm ] |
| Post subject: | Re: clsSocket verrs System |
I got a message on the computer saying my virtual memory was low. |
|
| Author: | Robin [ Sat Sep 20, 2008 4:51 pm ] |
| Post subject: | Re: clsSocket verrs System |
Delete your porn. Need more memory. |
|
| Author: | William [ Sat Sep 20, 2008 5:06 pm ] |
| Post subject: | Re: clsSocket verrs System |
Robin wrote: Delete your porn. Need more memory. It's my server computer, it uses Windows Server 2003 and rarely has anything fun on it. Except my awesome server. |
|
| Author: | JokeofWeek [ Sat Sep 20, 2008 5:35 pm ] |
| Post subject: | Re: clsSocket verrs System |
Out of Memory typically means out of system memory A.K.A. you're using too much Ram. Like I said, your server has a memory leak. Don't worry, you can turn off some things in CodeSMART and you can also make it so it only leaves a suggestion (in a comment) on what the problem is and how to fix it. EDIT: Sorry about that, meant CodeFixer all along, not CodeSMART. Here's a link : http://www.pscode.com/vb/scripts/ShowCo ... 7&lngWId=1 |
|
| Author: | Lea [ Sat Sep 20, 2008 5:50 pm ] |
| Post subject: | Re: clsSocket verrs System |
I agree it's a memory leak. Might be best off emailing Verrigan direct. Matt claims he answers his email. |
|
| Author: | FrankJScott [ Fri Feb 09, 2024 6:23 pm ] |
| Post subject: | Recommended Product Guide |
Please try Google before asking about Top Rated Product Guide 2eb6e42 |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|