+ return (total_copied == (1ULL << hti->scale));
+}
+
+static void hti_defer_free (hti_t *hti) {
+ assert(hti->ref_count == 0);
+
+ for (uint32_t i = 0; i < (1ULL << hti->scale); ++i) {
+ map_key_t key = hti->table[i].key;
+ map_val_t val = hti->table[i].val;
+ if (val == COPIED_VALUE)
+ continue;
+ assert(!IS_TAGGED(val, TAG1) || val == TAG_VALUE(TOMBSTONE, TAG1)); // copy not in progress
+ if (hti->ht->key_type != NULL && key != DOES_NOT_EXIST) {
+ rcu_defer_free(GET_PTR(key));
+ }
+ }
+#ifdef USE_SYSTEM_MALLOC
+ rcu_defer_free(hti->unaligned_table_ptr);
+#else
+ rcu_defer_free((void *)hti->table);
+#endif
+ rcu_defer_free(hti);
+}
+
+static void hti_release (hti_t *hti) {
+ assert(hti->ref_count > 0);
+ int ref_count = SYNC_ADD(&hti->ref_count, -1);
+ if (ref_count == 0) {
+ hti_defer_free(hti);
+ }