This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2a/1][BZ #12486] Remove assert in malloc statistic.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 17 Oct 2013 15:18:58 -0400
- Subject: Re: [PATCH 2a/1][BZ #12486] Remove assert in malloc statistic.
- Authentication-results: sourceware.org; auth=none
- References: <20131017114140 dot GA24230 at domone dot podge> <20131017173351 dot GA4623 at domone dot podge>
On 10/17/2013 01:33 PM, OndÅej BÃlka wrote:
> A bug https://sourceware.org/bugzilla/show_bug.cgi?id=12486 is nearly
> duplicate of 11087.
>
> A bugzilla contains patch that adds locking around calculating maxima.
> As these asserts are almost useless for finding memory corruption a
> second possibility is to disable them.
>
> Comments?
>
> * malloc/malloc.c: remove checks for statistics.
>
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index 2938234..1a18c3f 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -2216,15 +2216,6 @@ static void do_check_malloc_state(mstate av)
> /* top chunk is OK */
> check_chunk(av, av->top);
>
> - /* sanity checks for statistics */
> -
> - assert(mp_.n_mmaps <= mp_.max_n_mmaps);
> -
> - assert((unsigned long)(av->system_mem) <=
> - (unsigned long)(av->max_system_mem));
> -
> - assert((unsigned long)(mp_.mmapped_mem) <=
> - (unsigned long)(mp_.max_mmapped_mem));
> }
> #endif
>
>
I agree that the asserts should be removed.
If we need more asserts later they can be added later
to solve a specific problem.
Adding locking for this is too much for little to no
reward.
Cheers,
Carlos.