diff options
Diffstat (limited to 'lib/talloc/talloc.h')
-rw-r--r-- | lib/talloc/talloc.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h index e48dc09a40..f3cbcd0e7c 100644 --- a/lib/talloc/talloc.h +++ b/lib/talloc/talloc.h @@ -1842,6 +1842,25 @@ void talloc_set_log_fn(void (*log_fn)(const char *message)); */ void talloc_set_log_stderr(void); +/** + * @brief Set a max memory limit for the current context hierarchy + * This affects all children of this context and constrain any + * allocation in the hierarchy to never exceed the limit set. + * The limit can be removed by setting 0 (unlimited) as the + * max_size by calling the funciton again on the sam context. + * Memory limits can also be nested, meaning a hild can have + * a stricter memory limit than a parent. + * Memory limits are enforced only at memory allocation time. + * Stealing a context into a 'limited' hierarchy properly + * updates memory usage but does *not* cause failure if the + * move causes the new parent to exceed its limits. However + * any further allocation on that hierarchy will then fail. + * + * @param[in] ctx The talloc context to set the limit on + * @param[in] max_size The (new) max_size + */ +int talloc_set_memlimit(const void *ctx, size_t max_size); + /* @} ******************************************************************/ #if TALLOC_DEPRECATED |