diff options
author | Jeremy Allison <jra@samba.org> | 2013-08-27 12:46:09 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-08-27 15:44:19 -0700 |
commit | 4159a78ed7eda340758e22286f16186987a20f2f (patch) | |
tree | 6460d1f773d7f7549dcc0265ab33b4cf5ffa3362 | |
parent | 7a6beae68ee3f9a97e9e56f4e24a437839fb3e19 (diff) | |
download | samba-4159a78ed7eda340758e22286f16186987a20f2f.tar.gz samba-4159a78ed7eda340758e22286f16186987a20f2f.tar.bz2 samba-4159a78ed7eda340758e22286f16186987a20f2f.zip |
Change _talloc_total_mem_internal() to ignore memory allocated from a pool when calculating limit size.
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>
-rw-r--r-- | lib/talloc/talloc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 7b827ca0c1..1e25dfde4e 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1817,7 +1817,14 @@ static size_t _talloc_total_mem_internal(const void *ptr, 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; } |