| 102 | |
| 103 | template <typename C> |
| 104 | static void |
| 105 | free(RefCountCacheHashEntry *e) |
| 106 | { |
| 107 | // Since the Value is actually RefCountObj-- when this gets deleted normally it calls the wrong |
| 108 | // `free` method, this forces the delete/decr to happen with the right type |
| 109 | Ptr<C> *tmp = reinterpret_cast<Ptr<C> *>(&e->item); |
| 110 | tmp->clear(); |
| 111 | |
| 112 | e->~RefCountCacheHashEntry(); |
| 113 | dealloc(e); |
| 114 | } |
| 115 | }; |
| 116 | |
| 117 | // Since the hashing values are all fixed size, we can simply use a classAllocator to avoid mallocs |