Question about your FSF?

  • john

    I am trying to run the example "ex1". When I end the program, some memory leak information was found in my Visual Studio 6 IDE.

    So I tracked into the FSF code. I found that
    in your FsfSystem.h, you define a

            static CSystem *m_pSingle;

    when the function "static CSystem* GetInstance()" is called, you create a object with "new". But you didn't delete it when you exit the application.

    Am I true?

    • You are right, I apparently neglected to clean-up the system instance in the examples.  I should add a function to do that in the CSystem class, or, even better, find a smarter way of implementing the Singleton pattern (any suggestion?).
      Thanks for pointing this out.


      • john

        No suggestion for your implementation on Singleton pattern now. Maybe in the future.

        Another suggestion for your document is that you'd better point out how to setup Microsoft DirectX SDK environment with visual studio 6.0.

        I guess the last question on the problem of running example  is that he didn't setup the right environment for the DirectX. Am I right?

        • The FSF library does not depend on DirectX.  Only the video input
          modules do.  So the user guide examples and the image tutorial
          examples should run without DirectX.

    • john

              static CSystem* GetInstance(){
                      return m_pSingle;
                      static CSystem m_cSingle;
                      return (m_pSingle=&m_cSingle);
      //                return (m_pSingle=new CSystem);

      Please test it before adding to your library.

      Anyway, when I changed, I still find a memory leak. I run it in FsfDbg version. Any ideas?

      • In the FSF versions that use Windows threads, nothing ensures that all running threads will be allowed to terminate before the application is terminated.  This may result in reported memory leaks, because the objects allocated in those threads are never released.

        Furthermore, the Debug version is significantly slower than the Release version.  For such highly multithreaded systems, it is always a good idea not to work in Debug mode...