Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Question about your FSF?

Help
john
2005-04-01
2013-04-09
  • john
    john
    2005-04-01

    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.

      Alex

       
      • john
        john
        2005-04-01

        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
      john
      2005-04-01

          public:
              static CSystem* GetInstance(){
                  if(m_pSingle!=NULL)
                      return m_pSingle;
                  else
                  {
                      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...