ActiveX Browser Memory Leak

This forum is for reporting bugs in MediaMonkey for Windows 4. Note that version 4 is no longer actively maintained as it has been replaced by version 5.

Moderator: Gurus

CarlitoGil
Posts: 294
Joined: Sun Sep 07, 2008 10:46 am
Location: Dominican Republic
Contact:

ActiveX Browser Memory Leak

Post by CarlitoGil »

MM 3.2.0.1294, Windows 7 x64, IE8

This script demonstrates that DestroyControl does indeed destroy the control but does not free all memory (watch Task Manager)
Searched and asked and this is supposed to be the way to destroy browsers.

How to completely destroy ActiveX Browser?


###### Scripts.ini ######

[TestLeak]
Filename=TestLeak.vbs
Procname=TestLeak
DisplayName=Test Leak
Order=100
ScriptType=0
Language=VBScript
Description=Testing
Shortcut=Shift+Q



###### TestLeak.vbs ######

Option Explicit

Sub TestLeak()

Dim Timer, Form, WB

Set Timer = SDB.CreateTimer(2000)
Script.RegisterEvent Timer, "OnTimer", "TestLeakTimer"

Set Form = SDB.Objects("TestLeakWindow")
Set WB = SDB.Objects("TestLeakWebBrowser")

If Not (WB Is Nothing) Then
WB.Common.DestroyControl
Set WB = Nothing
Set SDB.Objects("TestLeakWebBrowser") = Nothing
If (Form.Common.Visible) Then Exit Sub
End If

If Not (Form Is Nothing) Then
If Not (Form.Common.Visible) Then Script.UnregisterEvents Timer
Script.UnregisterEvents Form
Form.Common.Visible = False
Form.Common.ControlName = ""
Set Form = Nothing
Set SDB.Objects("TestLeakWindow") = Nothing
Exit Sub
End If

Set Form = SDB.UI.NewForm
Form.Common.SetRect 50, 50, 600, 400
Form.Common.MinWidth = 400
Form.Common.MinHeight = 300
Form.FormPosition = 4
Form.StayOnTop = False
Form.Caption = "Test Leak"
Form.Common.ControlName = "TestLeak"

Set WB = SDB.UI.NewActiveX(Form, "Shell.Explorer")
WB.Common.Align = 5
WB.Common.ControlName = "WB"

SDB.Objects("TestLeakWindow") = Form
SDB.Objects("TestLeakWebBrowser") = WB

WB.Interf.Navigate "google.com"

Form.Common.Visible = True

End Sub

Sub TestLeakTimer(Timer)

Script.UnregisterEvents Timer
Call TestLeak()

End Sub
iTunesMonkey + Acoustid – Find metadata from iTunes and Acoustid
Ludek
Posts: 5103
Joined: Fri Mar 09, 2007 9:00 am

Re: ActiveX Browser Memory Leak

Post by Ludek »

Post Reply