Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Need help desperately

Hi everyone,

I have an app that uses the Active Movie Library to display many AVI files (one at a time) and am getting HUGE memory leaks after each AVI is opened.

I need to know if its just my system as one friend tried my code and reported no great change in memory usage.

Please, it'll take you 5 mins to try this out. If you could report back to me here I'd be eternally grateful. I need to know if you get the leak too.

Reference to Active Movie Library, Common Dialog control from components, 1 Picture box, 2 command buttons.


Private m_boolVideoRunning As Boolean       'Flag used to trigger clock
Private m_objBasicAudio  As IBasicAudio         'Basic Audio Object
Private m_objBasicVideo As IBasicVideo          'Basic Video Object
Private m_objMediaEvent As IMediaEvent        'MediaEvent Object
Private m_objVideoWindow As IVideoWindow   'VideoWindow Object
Private m_objMediaControl As IMediaControl    'MediaControl Object
Private m_objMediaPosition As IMediaPosition 'MediaPosition Object
Private Sub Command1_Click()
Dim m_bstrfilename As String
    CommonDialog1.Filter = "Open an AVI File (*.avi)|*.avi"
    m_bstrfilename = ""
    m_bstrfilename = CommonDialog1.FileName
    Set m_objMediaControl = New FilgraphManager
    Call m_objMediaControl.RenderFile(m_bstrfilename)

    Set m_objBasicAudio = m_objMediaControl

    Set m_objVideoWindow = m_objMediaControl
    m_objVideoWindow.WindowStyle = CLng(&H6000000)
    m_objVideoWindow.Top = 0
    m_objVideoWindow.Left = 0
    m_objVideoWindow.Width = Picture1.Width
    m_objVideoWindow.Height = Picture1.Height
    m_objVideoWindow.Owner = Picture1.hWnd
    Set m_objMediaEvent = m_objMediaControl
    Set m_objMediaPosition = m_objMediaControl

End Sub
Private Sub cleardxpreview()
    If Not m_objMediaControl Is Nothing Then
    End If
    If Not m_objVideoWindow Is Nothing Then
        m_objVideoWindow.Left = Screen.Width * 8
        m_objVideoWindow.Top = Screen.Height * 8
        m_objVideoWindow.Owner = 0
    End If
    Set m_objBasicAudio = Nothing
    Set m_objBasicVideo = Nothing
    Set m_objMediaControl = Nothing
    Set m_objVideoWindow = Nothing
    Set m_objMediaPosition = Nothing
    Set m_objMediaPosition = Nothing

End Sub

Private Sub Command2_Click()
End Sub

Private Sub Form_Load()
End Sub

Private Sub Form_Unload(Cancel As Integer)
End Sub

2 Solutions
Hi I tried your code out and didnt have any significant memory loss. The program stayed in the 38-50k range even after loading multiple avi's and total system memory reported the same. It might be the avi you are using for testing.
same here. No significant increase in memory usage.
BrommersAuthor Commented:
Thanks guys it looks like the problem was codec related since upon testing AVI's not compressed with the normal codec I used the problem seems to have disappeared

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now