From da27429fc4051834d482b930c8cfde2ce98774ed Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 29 Nov 2016 22:36:29 +0300 Subject: [PATCH] Reverted commit e32b8206c8fff235765277ee3f7c42517c4b52a5, use another way to fix memory leak --- cds/algo/flat_combining/defs.h | 2 -- cds/algo/flat_combining/kernel.h | 15 +-------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/cds/algo/flat_combining/defs.h b/cds/algo/flat_combining/defs.h index 5b1d2ccd..a959e8ec 100644 --- a/cds/algo/flat_combining/defs.h +++ b/cds/algo/flat_combining/defs.h @@ -61,7 +61,6 @@ namespace cds { namespace algo { namespace flat_combining { atomics::atomic nState; ///< Record state: inactive, active, removed atomics::atomic nAge; ///< Age of the record atomics::atomic pNext; ///< Next record in publication list - void * pOwner; ///< [internal data] Pointer to \ref kernel object that manages the publication list /// Initializes publication record publication_record() @@ -69,7 +68,6 @@ namespace cds { namespace algo { namespace flat_combining { , nState( inactive ) , nAge( 0 ) , pNext( nullptr ) - , pOwner( nullptr ) {} /// Returns the value of \p nRequest field diff --git a/cds/algo/flat_combining/kernel.h b/cds/algo/flat_combining/kernel.h index c0a3a7dc..cbc39b77 100644 --- a/cds/algo/flat_combining/kernel.h +++ b/cds/algo/flat_combining/kernel.h @@ -293,8 +293,6 @@ namespace cds { namespace algo { { // mark all publication record as detached for ( publication_record* p = m_pHead; p; ) { - p->pOwner = nullptr; - publication_record * pRec = p; p = p->pNext.load( memory_model::memory_order_relaxed ); free_publication_record( static_cast( pRec )); @@ -312,7 +310,6 @@ namespace cds { namespace algo { if ( !pRec ) { // Allocate new publication record pRec = cxx11_allocator().New(); - pRec->pOwner = reinterpret_cast( this ); m_pThreadRec.reset( pRec ); m_Stat.onCreatePubRecord(); } @@ -570,16 +567,7 @@ namespace cds { namespace algo { { // Thread done // pRec that is TLS data should be excluded from publication list - if ( pRec ) { - if ( pRec->pOwner ) { - // kernel is alive - pRec->nState.store( removed, memory_model::memory_order_release ); - } - else { - // kernel already deleted - free_publication_record( pRec ); - } - } + pRec->nState.store( removed, memory_model::memory_order_release ); } static void free_publication_record( publication_record_type* pRec ) @@ -592,7 +580,6 @@ namespace cds { namespace algo { assert( m_pThreadRec.get() == nullptr ); publication_record_type* pRec = cxx11_allocator().New(); m_pHead = pRec; - pRec->pOwner = this; m_pThreadRec.reset( pRec ); m_Stat.onCreatePubRecord(); } -- 2.34.1