| 58 | } |
| 59 | |
| 60 | InitCDS::~InitCDS() |
| 61 | { |
| 62 | cds::gc::dhp::smr::destruct(true); |
| 63 | |
| 64 | char str[512]; |
| 65 | |
| 66 | // CDS_ENABLE_HPSTAT is not defined by default. |
| 67 | // Rebuild of libcds after change is required. |
| 68 | |
| 69 | #ifdef CDS_ENABLE_HPSTAT |
| 70 | cds::gc::DHP::stat const& st = cds::gc::DHP::postmortem_statistics(); |
| 71 | |
| 72 | sprintf(str, "DHP statistics:\n" |
| 73 | " thread count = %llu\n" |
| 74 | " guard allocated = %llu\n" |
| 75 | " guard freed = %llu\n" |
| 76 | " retired data count = %llu\n" |
| 77 | " free data count = %llu\n" |
| 78 | " HP blocks allocated = %llu\n" |
| 79 | " retired blocks allocated = %llu\n" |
| 80 | " hp array extend() calls = %llu\n" |
| 81 | " retired array extend() = %llu\n" |
| 82 | " scan() call count = %llu\n" |
| 83 | " help_scan() call count = %llu\n" |
| 84 | "\n", |
| 85 | st.thread_rec_count, |
| 86 | st.guard_allocated, st.guard_freed, |
| 87 | st.retired_count, st.free_count, |
| 88 | st.hp_block_count, st.retired_block_count, |
| 89 | st.hp_extend_count, st.retired_extend_count, |
| 90 | st.scan_count, st.help_scan_count |
| 91 | ); |
| 92 | gds__log(str); |
| 93 | #endif |
| 94 | cds::Terminate(); |
| 95 | |
| 96 | // no need to protect m_pools at this point |
| 97 | while (m_pools->hasData()) |
| 98 | { |
| 99 | MemoryPool* pool = m_pools->pop(); |
| 100 | MemoryPool::deletePool(pool); |
| 101 | } |
| 102 | |
| 103 | delete m_pools; |
| 104 | MemoryPool::deletePool(m_pool); |
| 105 | |
| 106 | #ifdef DEBUG_CDS_MEMORY |
| 107 | sprintf(str, "DHP pool stats:\n" |
| 108 | " usage = %llu\n" |
| 109 | " mapping = %llu\n" |
| 110 | " max usage = %llu\n" |
| 111 | " max mapping = %llu\n" |
| 112 | "\n", |
| 113 | m_stats.getCurrentUsage(), |
| 114 | m_stats.getCurrentMapping(), |
| 115 | m_stats.getMaximumUsage(), |
| 116 | m_stats.getMaximumMapping() |
| 117 | ); |
nothing calls this directly
no test coverage detected