Tracking Down a Memory Leak in a Filter RRS feed

  • Question

  • I've created a filter derived from CTransformFilter (VS2008). A the moment, the code simply copies bytes from the input to output (in Transform() function), the rest is just the basic boiler plate code (CheckTransform(), CheckInputType() etc). At no point do I ever allocate or deallocate anything (except in DecideBufferSize).

    If I add the filter to a graph and do nothing with it (no pin connects) then I still get the memory leaks reported - in this case the only parts of my code that get called are the Create() and NonDelegatingQueryInterface() functions so I can definitely say it 'aint me whose allocated whatever isn't being deallocated.

    I can instantiate 1, 2 or even 3 instances of the filter on the same graph but the number of reported memory leaks does not increase -> I assume it is something to do with the loading of the AX file that contains the filter?

    There's 50+ of these leaks, each of the order 20-40 bytes, along the lines of :

    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {74} normal block at 0x01A61348, 26 bytes long.
     Data: <<N x            > 3C 4E 97 78 09 00 00 00 09 00 00 00 01 00 00 00 

    The allocation numbers (e.g. 74 in above example) are consistent. However using the_crtBreakAlloc trick (e.g. http://msdn.microsoft.com/en-us/library/w2fhc9a3(v=vs.90).aspx) does NOT cause a break to occur.

    Visual Leak Detector says there are no leaks.

    Anyone think of a way of finding / fixing the leaks ? Or are they leaks that aren't real so I can ignore them ?



    Wednesday, November 28, 2012 11:30 AM


  • The logged blocks of memory are "leaks" because they are not freed. One of the typical scenarios is that you have a good COM object in your module, but there is something with external references on it, something external does not free it and at unload time thus your COM object and all the internal memory blocks it holds - they are not freed and reported.

    Eventually you still want to know what exactly are those reported blocks, which class or an allocation they correspond to.


    • Marked as answer by Roujansky_Jr Sunday, February 17, 2013 10:50 AM
    Friday, November 30, 2012 10:52 AM