Changeset 121 in 3DVCSoftware for trunk/source/Lib/TLibCommon


Ignore:
Timestamp:
6 Sep 2012, 18:12:56 (12 years ago)
Author:
tech
Message:

Fixed several memory leaks.

Location:
trunk/source/Lib/TLibCommon
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r116 r121  
    9090  m_pcTrCoeffCr        = NULL;
    9191#if ADAPTIVE_QP_SELECTION 
     92#if FIX_MEM_LEAKS
     93  m_ArlCoeffIsAliasedAllocation = false;
    9294  m_pcArlCoeffY        = NULL;
    9395  m_pcArlCoeffCb       = NULL;
    9496  m_pcArlCoeffCr       = NULL;
     97#endif
    9598#endif
    9699 
     
    247250      m_pcArlCoeffCb       = m_pcGlbArlCoeffCb;
    248251      m_pcArlCoeffCr       = m_pcGlbArlCoeffCr;
     252#if FIX_MEM_LEAKS
     253      m_ArlCoeffIsAliasedAllocation = true;
     254#endif
    249255    }
    250256    else
     
    362368    if ( m_pcTrCoeffCr        ) { xFree(m_pcTrCoeffCr);         m_pcTrCoeffCr       = NULL; }
    363369#if ADAPTIVE_QP_SELECTION
     370#if FIX_MEM_LEAKS
     371    if (!m_ArlCoeffIsAliasedAllocation)
     372    {
     373      xFree(m_pcArlCoeffY); m_pcArlCoeffY = 0;
     374      xFree(m_pcArlCoeffCb); m_pcArlCoeffCb = 0;
     375      xFree(m_pcArlCoeffCr); m_pcArlCoeffCr = 0;
     376    }
     377#endif
    364378    if ( m_pcGlbArlCoeffY     ) { xFree(m_pcGlbArlCoeffY);      m_pcGlbArlCoeffY    = NULL; }
    365379    if ( m_pcGlbArlCoeffCb    ) { xFree(m_pcGlbArlCoeffCb);     m_pcGlbArlCoeffCb   = NULL; }
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r118 r121  
    159159  Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
    160160  Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
     161#if FIX_MEM_LEAKS
     162  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
     163#endif
    161164
    162165  static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
    163166  static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
    164167  static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
     168
    165169#endif
    166170 
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r56 r121  
    122122  m_apcTComDataCU = NULL;
    123123
     124
     125#if FIX_MEM_LEAKS
     126  for( i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
     127  {
     128    if ( m_apcTComTile[i] )  delete m_apcTComTile[i];
     129  }
     130#endif
     131
    124132  delete [] m_apcTComTile;
    125133  m_apcTComTile = NULL;
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r118 r121  
    4747#define FIX_INIT_ROM                      1
    4848#define FIX_VIRT_DESTRUCTOR               1
     49#define FIX_MEM_LEAKS                     1
    4950
    5051#define FIX_LG_RESTRICTEDRESPRED_M24766   1
     52#define FIX_REMOVE_TILE_DEPENDENCE        1
    5153
    5254
Note: See TracChangeset for help on using the changeset viewer.