?
Solved

Need help desperately

Posted on 2005-04-04
3
Medium Priority
?
264 Views
Last Modified: 2008-03-06
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"
    CommonDialog1.ShowOpen
    m_bstrfilename = ""
    m_bstrfilename = CommonDialog1.FileName
    cleardxpreview
    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
    m_objMediaControl.Pause


End Sub
Private Sub cleardxpreview()
    If Not m_objMediaControl Is Nothing Then
        m_objMediaControl.Stop
    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()
m_objMediaControl.Run
End Sub

Private Sub Form_Load()
Me.Show
End Sub

Private Sub Form_Unload(Cancel As Integer)
cleardxpreview
End Sub

0
Comment
Question by:Brommers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
-dev- earned 500 total points
ID: 13703372
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.
0
 
LVL 9

Assisted Solution

by:riaancornelius
riaancornelius earned 500 total points
ID: 13704351
same here. No significant increase in memory usage.
0
 
LVL 1

Author Comment

by:Brommers
ID: 13740587
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
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question