source:
clfs-sysroot/patches/glibc-2.6-branch_update-1.patch@
b07cfb1
Last change on this file since b07cfb1 was 00520f6, checked in by , 17 years ago | |
---|---|
|
|
File size: 5.8 KB |
-
libc/malloc/arena.c
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 06-05-2007 Initial Package Version: 2.6 Origin: Upstream Upstream Status: Applied Description: This is a branch update for Glibc-2.6, and should be rechecked periodically. See the 'Changelog' and 'localedata/ChangeLog' for specific details. 2007-05-21 Jakub Jelinek <jakub@redhat.com> * malloc/hooks.c (MALLOC_STATE_VERSION): Bump. (public_sET_STATe): If ms->version < 3, put all chunks into unsorted chunks and clear {fd,bk}_nextsize fields of largebin chunks. * malloc/malloc.c (do_check_malloc_state): Don't assert n_mmaps is not greater than n_mmaps_max. * malloc/malloc.c [MALLOC_DEBUG]: Revert 2007-05-13 changes. * malloc/hooks.c: Likewise. * malloc/arena.c: Likewise. * malloc/Makefile (CFLAGS-malloc.c): Revert accidental 2007-05-07 commit.
old new ptmalloc_init_minimal (void) 370 370 mp_.top_pad = DEFAULT_TOP_PAD; 371 371 #endif 372 372 mp_.n_mmaps_max = DEFAULT_MMAP_MAX; 373 #if MALLOC_DEBUG374 mp_.n_mmaps_cmax = DEFAULT_MMAP_MAX;375 #endif376 373 mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD; 377 374 mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD; 378 375 mp_.pagesize = malloc_getpagesize; -
libc/malloc/malloc.c
old new struct malloc_par { 2358 2358 /* Memory map support */ 2359 2359 int n_mmaps; 2360 2360 int n_mmaps_max; 2361 #if MALLOC_DEBUG2362 int n_mmaps_cmax;2363 #endif2364 2361 int max_n_mmaps; 2365 2362 /* the mmap_threshold is dynamic, until the user sets 2366 2363 it manually, at which point we need to disable any … … static void do_check_malloc_state(mstate 2876 2873 assert(total <= (unsigned long)(mp_.max_total_mem)); 2877 2874 assert(mp_.n_mmaps >= 0); 2878 2875 #endif 2879 assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);2880 assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);2881 2876 assert(mp_.n_mmaps <= mp_.max_n_mmaps); 2882 2877 2883 2878 assert((unsigned long)(av->system_mem) <= … … munmap_chunk(p) mchunkptr p; 3475 3470 } 3476 3471 3477 3472 mp_.n_mmaps--; 3478 #if MALLOC_DEBUG3479 if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)3480 {3481 assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);3482 mp_.n_mmaps_cmax = mp_.n_mmaps;3483 }3484 #endif3485 3473 mp_.mmapped_mem -= total_size; 3486 3474 3487 3475 int ret __attribute__ ((unused)) = munmap((char *)block, total_size); … … mstate av; size_t n_elements; size_t* si 5397 5385 mp_.n_mmaps_max = 0; 5398 5386 mem = _int_malloc(av, size); 5399 5387 mp_.n_mmaps_max = mmx; /* reset mmap */ 5400 #if MALLOC_DEBUG5401 mp_.n_mmaps_cmax = mmx;5402 #endif5403 5388 if (mem == 0) 5404 5389 return 0; 5405 5390 … … int mALLOPt(param_number, value) int par 5725 5710 res = 0; 5726 5711 else 5727 5712 #endif 5728 { 5729 #if MALLOC_DEBUG 5730 if (mp_.n_mmaps <= value) 5731 mp_.n_mmaps_cmax = value; 5732 else 5733 mp_.n_mmaps_cmax = mp_.n_mmaps; 5734 #endif 5735 5736 mp_.n_mmaps_max = value; 5737 mp_.no_dyn_threshold = 1; 5738 } 5713 mp_.n_mmaps_max = value; 5714 mp_.no_dyn_threshold = 1; 5739 5715 break; 5740 5716 5741 5717 case M_CHECK_ACTION: -
libc/malloc/hooks.c
old new free_starter(mem, caller) Void_t* mem; c 496 496 then the hooks are reset to 0. */ 497 497 498 498 #define MALLOC_STATE_MAGIC 0x444c4541l 499 #define MALLOC_STATE_VERSION (0*0x100l + 2l) /* major*0x100 + minor */499 #define MALLOC_STATE_VERSION (0*0x100l + 3l) /* major*0x100 + minor */ 500 500 501 501 struct malloc_save_state { 502 502 long magic; … … struct malloc_save_state { 507 507 unsigned long trim_threshold; 508 508 unsigned long top_pad; 509 509 unsigned int n_mmaps_max; 510 #if MALLOC_DEBUG511 unsigned int n_mmaps_cmax;512 #endif513 510 unsigned long mmap_threshold; 514 511 int check_action; 515 512 unsigned long max_sbrked_mem; … … public_gET_STATe(void) 553 550 ms->trim_threshold = mp_.trim_threshold; 554 551 ms->top_pad = mp_.top_pad; 555 552 ms->n_mmaps_max = mp_.n_mmaps_max; 556 #if MALLOC_DEBUG557 ms->n_mmaps_cmax = mp_.n_mmaps_cmax;558 #endif559 553 ms->mmap_threshold = mp_.mmap_threshold; 560 554 ms->check_action = check_action; 561 555 ms->max_sbrked_mem = main_arena.max_system_mem; … … public_sET_STATe(Void_t* msptr) 601 595 assert(ms->av[2*i+3] == 0); 602 596 first(b) = last(b) = b; 603 597 } else { 604 if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i && 605 largebin_index(chunksize(ms->av[2*i+3]))==i)) { 598 if(ms->version >= 3 && 599 (i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i && 600 largebin_index(chunksize(ms->av[2*i+3]))==i))) { 606 601 first(b) = ms->av[2*i+2]; 607 602 last(b) = ms->av[2*i+3]; 608 603 /* Make sure the links to the bins within the heap are correct. */ … … public_sET_STATe(Void_t* msptr) 622 617 } 623 618 } 624 619 } 620 if (ms->version < 3) { 621 /* Clear fd_nextsize and bk_nextsize fields. */ 622 b = unsorted_chunks(&main_arena)->fd; 623 while (b != unsorted_chunks(&main_arena)) { 624 if (!in_smallbin_range(chunksize(b))) { 625 b->fd_nextsize = NULL; 626 b->bk_nextsize = NULL; 627 } 628 b = b->fd; 629 } 630 } 625 631 mp_.sbrk_base = ms->sbrk_base; 626 632 main_arena.system_mem = ms->sbrked_mem_bytes; 627 633 mp_.trim_threshold = ms->trim_threshold; 628 634 mp_.top_pad = ms->top_pad; 629 635 mp_.n_mmaps_max = ms->n_mmaps_max; 630 #if MALLOC_DEBUG631 mp_.n_mmaps_cmax = ms->n_mmaps_cmax;632 #endif633 636 mp_.mmap_threshold = ms->mmap_threshold; 634 637 check_action = ms->check_action; 635 638 main_arena.max_system_mem = ms->max_sbrked_mem; -
libc/malloc/Makefile
old new $(objpfx)memusagestat: $(memusagestat-mo 104 104 include ../Rules 105 105 106 106 CFLAGS-mcheck-init.c = $(PIC-ccflag) 107 CFLAGS-malloc.c += -DMALLOC_DEBUG108 107 109 108 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o 110 109 -rm -f $@
Note:
See TracBrowser
for help on using the repository browser.