Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Sub GameDestroy()


zidsal
 Share

Recommended Posts

```
' Closes the game client.
Sub GameDestroy()
    ' Unloads all TCP-related things.
    Call TcpDestroy

    ' Unloads all DirectX objects.
    Call DestroyDirectX

    ' Unloads the BGM in memory (soon-to-be obsolete).
    Call StopBGM

    ' Closes the VB6 application.
    End
End Sub
```
I'm proberly wrong and missing something obvoius but why in hells name is eclipse using end instead of unload frmmirage e.t.c. Isn't that just going to end badly as it will leave it running in memory?
Link to comment
Share on other sites

talked to robin about it and I was right using end is horrible as it gives very bad memory leaks. I ripped this from mirage source 4 it remains untested credit is given to mirage.

Change Sub GameDestroy() to this:

```
' Closes the game client.
Sub GameDestroy()
    ' Unloads all TCP-related things.
    Call TcpDestroy

    ' Unloads all DirectX objects.
    Call DestroyDirectX

    ' Unloads the BGM in memory (soon-to-be obsolete).
    Call StopBGM

    ' Closes the VB6 application.
    Call UnloadAllForms
End Sub
```
Add this new sub
```
Public Sub UnloadAllForms()
    Dim frm As Form

    For Each frm In VB.Forms
        Unload frm
    Next
End Sub
```
thats one less memory leak to worry about.

I reccomomend every does to fix
Link to comment
Share on other sites

@[WTF:

> Rage link=topic=38926.msg377516#msg377516 date=1234975618]
> ```
> For Each frm In VB.Forms
> ```
> Are you sure you can do that? (It's been a while since I used Vb)

ripped it out directly from a mirage 4 soruce so ya I guess you can do that

EDIT
Though going to add before today I'd never heard of a for each statement
Link to comment
Share on other sites

Wow, i'm new to the Dev team and haven't caught this yet. Nice for finding this, i'm going to make this apparent to the rest of the team and look into it further.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...