When the thread terminated its guard pool is backed to common GC's pool.
- \p nEpochCount: internally, DHP memory manager uses epoch-based schema to solve
ABA problem for internal data. \p nEpochCount specifies the epoch count,
-
i.e. the count of simultaneously working threads that remove the elements
- of DHP-based concurrent data structure. Default value is 8.
-
+ of DHP-based concurrent data structure. Default value is 16.
*/
static void CDS_STDCALL Construct(
size_t nLiberateThreshold = 1024
, size_t nInitialThreadGuardCount = 8
- , size_t nEpochCount = 8
+ , size_t nEpochCount = 16
);
/// Destroys DHP memory manager
When a thread is initialized the GC allocates local guard pool for the thread from common guard pool.
By perforce the local thread's guard pool is grown automatically from common pool.
When the thread terminated its guard pool is backed to common GC's pool.
+ - \p nEpochCount: internally, DHP memory manager uses epoch-based schema to solve
+ ABA problem for internal data. \p nEpochCount specifies the epoch count,
+ i.e. the count of simultaneously working threads that remove the elements
+ of DHP-based concurrent data structure. Default value is 16.
*/
DHP(
size_t nLiberateThreshold = 1024
, size_t nInitialThreadGuardCount = 8
+ , size_t nEpochCount = 16
)
{
- dhp::GarbageCollector::Construct(
- nLiberateThreshold,
- nInitialThreadGuardCount
- );
+ dhp::GarbageCollector::Construct( nLiberateThreshold, nInitialThreadGuardCount, nEpochCount );
}
/// Destroys %DHP memory manager
GarbageCollector::GarbageCollector( size_t nLiberateThreshold, size_t nInitialThreadGuardCount, size_t nEpochCount )
: m_nLiberateThreshold( nLiberateThreshold ? nLiberateThreshold : 1024 )
, m_nInitialThreadGuardCount( nInitialThreadGuardCount ? nInitialThreadGuardCount : 8 )
- , m_RetiredAllocator( static_cast<unsigned int>(nEpochCount))
+ , m_RetiredAllocator( static_cast<unsigned int>( nEpochCount ? nEpochCount : 16 ))
, m_bStatEnabled( false )
{}
int num_errors;
{
size_t nHazardPtrCount = 0;
+ size_t dhp_liberateThreshold;
+ size_t dhp_initialThreadGuardCount;
+ size_t dhp_epochCount;
{
CppUnitMini::TestCfg& cfg = CppUnitMini::TestCase::m_Cfg.get( "General" );
nHazardPtrCount = cfg.getULong( "hazard_pointer_count", 0 );
+
+ dhp_liberateThreshold = cfg.getSizeT( "dhp_liberate_threshold", 1024 );
+ dhp_initialThreadGuardCount = cfg.getSizeT( "dhp_init_guard_count", 8 );
+ dhp_epochCount = cfg.getSizeT( "dhp_epoch_count", 16 );
}
// Safe reclamation schemes
cds::gc::HP hzpGC( nHazardPtrCount );
- cds::gc::DHP dhpGC;
+ cds::gc::DHP dhpGC( dhp_liberateThreshold, dhp_initialThreadGuardCount, dhp_epochCount );
// RCU varieties
typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_gpi;
HZP_scan_strategy=inplace\r
hazard_pointer_count=72\r
\r
+# cds::gc::DHP initialization parameters\r
+dhp_liberate_threshold=1024\r
+dhp_init_guard_count=8\r
+dhp_epoch_count=16\r
+\r
[Atomic_ST]\r
iterCount=10000\r
\r
# Hazard pointer count per thread, for gc::HP\r
hazard_pointer_count=72\r
\r
+# cds::gc::DHP initialization parameters\r
+dhp_liberate_threshold=1024\r
+dhp_init_guard_count=16\r
+dhp_epoch_count=16\r
+\r
[Atomic_ST]\r
iterCount=1000000\r
\r
HZP_scan_strategy=inplace\r
hazard_pointer_count=72\r
\r
+# cds::gc::DHP initialization parameters\r
+dhp_liberate_threshold=1024\r
+dhp_init_guard_count=16\r
+dhp_epoch_count=16\r
+\r
[Atomic_ST]\r
iterCount=1000000\r
\r