We must only count normal tallocs, or a talloc pool itself.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit
4159a78ed7eda340758e22286f16186987a20f2f)
break;
case TOTAL_MEM_LIMIT:
if (likely(tc->name != TALLOC_MAGIC_REFERENCE)) {
- total = tc->size + TC_HDR_SIZE;
+ /*
+ * Don't count memory allocated from a pool
+ * when calculating limits. Only count the
+ * pool itself.
+ */
+ if (!(tc->flags & TALLOC_FLAG_POOLMEM)) {
+ total = tc->size + TC_HDR_SIZE;
+ }
}
break;
}