[PATCH] talloc memlimit deprecation
Jeremy Allison
jra at samba.org
Tue Oct 16 20:54:15 UTC 2018
On Tue, Oct 16, 2018 at 07:12:50PM +0200, David Disseldorp via samba-technical wrote:
> On Tue, 16 Oct 2018 09:41:35 -0700, Jeremy Allison via samba-technical wrote:
>
> > > https://lists.samba.org/archive/samba-technical/2012-September/087009.html
> > > indicates that it was intended for the LDAP server implementation, but
> > > never ended up being used.
> >
> > No, I'd love to get rid of talloc memlimit, but it would require
> > a major version revision.
>
> I've attached a patch which adds a deprecation attribute. Feedback
> appreciated.
>
> > Is there anyone out there actually using this ?
>
> I found one user on Github - FreeRADIUS have it for debugging:
> https://github.com/FreeRADIUS/freeradius-server/blob/master/src/bin/radiusd.c#L116
LGTM. RB+. I'll wait a day or so for further comment before pushing.
Jeremy.
> From d300156d4a57e56b9956cb88455798f9f9402b32 Mon Sep 17 00:00:00 2001
> From: David Disseldorp <ddiss at samba.org>
> Date: Tue, 16 Oct 2018 19:06:48 +0200
> Subject: [PATCH] talloc: deprecate talloc_set_memlimit()
>
> The memlimit functionality was never utilized by Samba. It adds unneeded
> complexity, so flag it as deprecated.
>
> Signed-off-by: David Disseldorp <ddiss at samba.org>
> ---
> lib/talloc/talloc.h | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
> index 7372df16fe8..ba3dee8de97 100644
> --- a/lib/talloc/talloc.h
> +++ b/lib/talloc/talloc.h
> @@ -1893,6 +1893,13 @@ void talloc_set_log_fn(void (*log_fn)(const char *message));
> */
> void talloc_set_log_stderr(void);
>
> +#ifndef _DEPRECATED_
> +#ifdef HAVE___ATTRIBUTE__
> +#define _DEPRECATED_ __attribute__ ((deprecated))
> +#else
> +#define _DEPRECATED_
> +#endif
> +#endif
> /**
> * @brief Set a max memory limit for the current context hierarchy
> * This affects all children of this context and constrain any
> @@ -1907,10 +1914,13 @@ void talloc_set_log_stderr(void);
> * move causes the new parent to exceed its limits. However
> * any further allocation on that hierarchy will then fail.
> *
> + * @warning talloc memlimit functionality is deprecated. Please
> + * consider using cgroup memory limits instead.
> + *
> * @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);
> +int talloc_set_memlimit(const void *ctx, size_t max_size) _DEPRECATED_;
>
> /* @} ******************************************************************/
>
> --
> 2.13.7
>
More information about the samba-technical
mailing list