This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mallopt indentation bug?


On 09/04/2012 05:28 PM, Alexandre Oliva wrote:
The assignment to no_dyn_threshold is indented as if it was meant to be
run only in the else branch, but since C is not Python, it's run
unconditionally.  That's not necessarily a bug, but since indentation is
misleading here, I figured I'd better fix it one way or the other, and I
decided to add braces to match the intent implied by indentation, rather
than reindent.

Patch pushed to lxoliva/malloc-probes-bz742038. Ok for master?

for ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* malloc/malloc.c (__libc_mallopt) <M_MMAP_THRESHOLD>: Do not
	change internal state upon failure.
---

  malloc/malloc.c |    6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/malloc/malloc.c b/malloc/malloc.c index 0f1796c..dd83551 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -4766,8 +4766,10 @@ int __libc_mallopt(int param_number, int value) if((unsigned long)value > HEAP_MAX_SIZE/2) res = 0; else - mp_.mmap_threshold = value; - mp_.no_dyn_threshold = 1; + { + mp_.mmap_threshold = value; + mp_.no_dyn_threshold = 1; + } break;
This looks correct to me.

If we don't change the mmap threshold there's no reason to turn of the dynamic mmap threshold heuristics.

I doubt I count as a senior developer for glibc, so it'd be best to wait for someone else to chime in before pushing.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]