Re: Memory leak in small video player application



On Mon, 16 Jan 2006 19:28:10 +0100, Gaël Rosset wrote:

> I have made a small video player which in turns plays small video clips.
> The class soundvideoplayer contains among other things the following
> members :
> IMediaEventEx *g_pEvent;
> IGraphBuilder *pGraph;
> IMediaControl *pControl;
> IMediaEvent *pEvent;
> IMediaSeeking *g_pSeek;
> IBaseFilter *pFilter;
> IBasicAudio *m_pBA;
>
> To play the clips I call the function play below over and over again.
> The problem is that even if I don't run the graph I am leaking memory by
> calling play in loops.
>
> I am calling Release on all used interfaces... I feel blind about the
> issue.

The first thing to do is convert these and all other plain pointers to use
CComPtr and CComQIPtr. It is madness to use plain pointers. You can
release all of the pointers properly with smart pointers by using them in a
class and destroying that class or by using them in a method and exiting
that method.

--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
.



Relevant Pages

  • Memory leak in small video player application
    ... I have made a small video player which in turns plays small video clips. ... IMediaEventEx *g_pEvent; ... To play the clips I call the function play below over and over again. ...
    (microsoft.public.win32.programmer.directx.video)
  • How to embed and view video clips
    ... I need to email a presentation that contains video clips. ... that embeds the file in the presentation and I can play it on any pc. ... Windows Media player activates to play the clip. ...
    (microsoft.public.powerpoint)
  • Re: Avi videos only play zoomed to full screen
    ... cine file to play on one section of the screen, ... section of the screen just goes blank when I get to the slide with the ... The video clips in a powerpoint ... to full screen" they do play on the new laptop. ...
    (microsoft.public.powerpoint)
  • Re: Avis refuse to play in Windows Media Player 9 and Bsplayer!
    ... Do they play back correctly locally? ... There's 800+ codecs and it's actually technically impossible to have them ... play correctly in either video player. ... What can I do to get avi files to play correctly and in sync using ...
    (microsoft.public.windowsmedia.player)
  • Re: Video Playback in PowerPoint
    ... I suspect what is happening is that your machine doesn't have the exact codec required, is substituting something that is close (Example: Divx 4 instead of Divx5) and the result is less than desirable playback. ... Can you play the the video in the MCI player (NOT Windows Media Player) properly? ... experiencing is that some, not all, of the video clips have picture stutter ...
    (microsoft.public.powerpoint)