+1 May 2018: Wouter
+ - Fix that unbound-control reload frees the rrset keys and returns
+ the memory pages to the system.
+
30 April 2018: Wouter
- Fix spelling error in man page and note defaults as no instead of
off.
}
}
+/** free the special list */
+static void
+alloc_clear_special_list(struct alloc_cache* alloc)
+{
+ alloc_special_type* p, *np;
+ /* free */
+ p = alloc->quar;
+ while(p) {
+ np = alloc_special_next(p);
+ /* deinit special type */
+ lock_rw_destroy(&p->entry.lock);
+ free(p);
+ p = np;
+ }
+}
+
+void
+alloc_clear_special(struct alloc_cache* alloc)
+{
+ if(!alloc->super) {
+ lock_quick_lock(&alloc->lock);
+ }
+ alloc_clear_special_list(alloc);
+ alloc->quar = 0;
+ alloc->num_quar = 0;
+ if(!alloc->super) {
+ lock_quick_unlock(&alloc->lock);
+ }
+}
+
void
alloc_clear(struct alloc_cache* alloc)
{
- alloc_special_type* p, *np;
+ alloc_special_type* p;
struct regional* r, *nr;
if(!alloc)
return;
alloc->super->num_quar += alloc->num_quar;
lock_quick_unlock(&alloc->super->lock);
} else {
- /* free */
- p = alloc->quar;
- while(p) {
- np = alloc_special_next(p);
- /* deinit special type */
- lock_rw_destroy(&p->entry.lock);
- free(p);
- p = np;
- }
+ alloc_clear_special_list(alloc);
}
alloc->quar = 0;
alloc->num_quar = 0;
*/
void alloc_clear(struct alloc_cache* alloc);
+/**
+ * Free the special alloced items. The rrset and message caches must be
+ * empty, there must be no more references to rrset pointers into the
+ * rrset cache.
+ * @param alloc: the special allocs are freed.
+ */
+void alloc_clear_special(struct alloc_cache* alloc);
+
/**
* Get a new special_type element.
* @param alloc: where to alloc it.