[44426cf] | 1 | Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
|
---|
| 2 | Date: 06-05-2007
|
---|
| 3 | Initial Package Version: 2.6
|
---|
| 4 | Origin: Upstream
|
---|
| 5 | Upstream Status: Applied
|
---|
| 6 | Description: This is a branch update for Glibc-2.6, and should be
|
---|
| 7 | rechecked periodically. See the 'Changelog' and 'localedata/ChangeLog'
|
---|
| 8 | for specific details.
|
---|
| 9 |
|
---|
| 10 | 2007-05-21 Jakub Jelinek <jakub@redhat.com>
|
---|
| 11 |
|
---|
| 12 | * malloc/hooks.c (MALLOC_STATE_VERSION): Bump.
|
---|
| 13 | (public_sET_STATe): If ms->version < 3, put all chunks into
|
---|
| 14 | unsorted chunks and clear {fd,bk}_nextsize fields of largebin
|
---|
| 15 | chunks.
|
---|
| 16 | * malloc/malloc.c (do_check_malloc_state): Don't assert
|
---|
| 17 | n_mmaps is not greater than n_mmaps_max.
|
---|
| 18 |
|
---|
| 19 | * malloc/malloc.c [MALLOC_DEBUG]: Revert 2007-05-13 changes.
|
---|
| 20 | * malloc/hooks.c: Likewise.
|
---|
| 21 | * malloc/arena.c: Likewise.
|
---|
| 22 | * malloc/Makefile (CFLAGS-malloc.c): Revert accidental
|
---|
| 23 | 2007-05-07 commit.
|
---|
| 24 |
|
---|
| 25 | --- libc/malloc/arena.c.jj 2007-05-20 20:01:52.000000000 +0200
|
---|
| 26 | +++ libc/malloc/arena.c 2007-05-21 11:18:13.000000000 +0200
|
---|
| 27 | @@ -370,9 +370,6 @@ ptmalloc_init_minimal (void)
|
---|
| 28 | mp_.top_pad = DEFAULT_TOP_PAD;
|
---|
| 29 | #endif
|
---|
| 30 | mp_.n_mmaps_max = DEFAULT_MMAP_MAX;
|
---|
| 31 | -#if MALLOC_DEBUG
|
---|
| 32 | - mp_.n_mmaps_cmax = DEFAULT_MMAP_MAX;
|
---|
| 33 | -#endif
|
---|
| 34 | mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
|
---|
| 35 | mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD;
|
---|
| 36 | mp_.pagesize = malloc_getpagesize;
|
---|
| 37 | --- libc/malloc/malloc.c.jj 2007-05-20 20:01:52.000000000 +0200
|
---|
| 38 | +++ libc/malloc/malloc.c 2007-05-21 11:19:32.000000000 +0200
|
---|
| 39 | @@ -2358,9 +2358,6 @@ struct malloc_par {
|
---|
| 40 | /* Memory map support */
|
---|
| 41 | int n_mmaps;
|
---|
| 42 | int n_mmaps_max;
|
---|
| 43 | -#if MALLOC_DEBUG
|
---|
| 44 | - int n_mmaps_cmax;
|
---|
| 45 | -#endif
|
---|
| 46 | int max_n_mmaps;
|
---|
| 47 | /* the mmap_threshold is dynamic, until the user sets
|
---|
| 48 | it manually, at which point we need to disable any
|
---|
| 49 | @@ -2876,8 +2873,6 @@ static void do_check_malloc_state(mstate
|
---|
| 50 | assert(total <= (unsigned long)(mp_.max_total_mem));
|
---|
| 51 | assert(mp_.n_mmaps >= 0);
|
---|
| 52 | #endif
|
---|
| 53 | - assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);
|
---|
| 54 | - assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);
|
---|
| 55 | assert(mp_.n_mmaps <= mp_.max_n_mmaps);
|
---|
| 56 |
|
---|
| 57 | assert((unsigned long)(av->system_mem) <=
|
---|
| 58 | @@ -3475,13 +3470,6 @@ munmap_chunk(p) mchunkptr p;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | mp_.n_mmaps--;
|
---|
| 62 | -#if MALLOC_DEBUG
|
---|
| 63 | - if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)
|
---|
| 64 | - {
|
---|
| 65 | - assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);
|
---|
| 66 | - mp_.n_mmaps_cmax = mp_.n_mmaps;
|
---|
| 67 | - }
|
---|
| 68 | -#endif
|
---|
| 69 | mp_.mmapped_mem -= total_size;
|
---|
| 70 |
|
---|
| 71 | int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
|
---|
| 72 | @@ -5397,9 +5385,6 @@ mstate av; size_t n_elements; size_t* si
|
---|
| 73 | mp_.n_mmaps_max = 0;
|
---|
| 74 | mem = _int_malloc(av, size);
|
---|
| 75 | mp_.n_mmaps_max = mmx; /* reset mmap */
|
---|
| 76 | -#if MALLOC_DEBUG
|
---|
| 77 | - mp_.n_mmaps_cmax = mmx;
|
---|
| 78 | -#endif
|
---|
| 79 | if (mem == 0)
|
---|
| 80 | return 0;
|
---|
| 81 |
|
---|
| 82 | @@ -5725,17 +5710,8 @@ int mALLOPt(param_number, value) int par
|
---|
| 83 | res = 0;
|
---|
| 84 | else
|
---|
| 85 | #endif
|
---|
| 86 | - {
|
---|
| 87 | -#if MALLOC_DEBUG
|
---|
| 88 | - if (mp_.n_mmaps <= value)
|
---|
| 89 | - mp_.n_mmaps_cmax = value;
|
---|
| 90 | - else
|
---|
| 91 | - mp_.n_mmaps_cmax = mp_.n_mmaps;
|
---|
| 92 | -#endif
|
---|
| 93 | -
|
---|
| 94 | - mp_.n_mmaps_max = value;
|
---|
| 95 | - mp_.no_dyn_threshold = 1;
|
---|
| 96 | - }
|
---|
| 97 | + mp_.n_mmaps_max = value;
|
---|
| 98 | + mp_.no_dyn_threshold = 1;
|
---|
| 99 | break;
|
---|
| 100 |
|
---|
| 101 | case M_CHECK_ACTION:
|
---|
| 102 | --- libc/malloc/hooks.c.jj 2007-05-20 20:01:52.000000000 +0200
|
---|
| 103 | +++ libc/malloc/hooks.c 2007-05-21 11:18:13.000000000 +0200
|
---|
| 104 | @@ -496,7 +496,7 @@ free_starter(mem, caller) Void_t* mem; c
|
---|
| 105 | then the hooks are reset to 0. */
|
---|
| 106 |
|
---|
| 107 | #define MALLOC_STATE_MAGIC 0x444c4541l
|
---|
| 108 | -#define MALLOC_STATE_VERSION (0*0x100l + 2l) /* major*0x100 + minor */
|
---|
| 109 | +#define MALLOC_STATE_VERSION (0*0x100l + 3l) /* major*0x100 + minor */
|
---|
| 110 |
|
---|
| 111 | struct malloc_save_state {
|
---|
| 112 | long magic;
|
---|
| 113 | @@ -507,9 +507,6 @@ struct malloc_save_state {
|
---|
| 114 | unsigned long trim_threshold;
|
---|
| 115 | unsigned long top_pad;
|
---|
| 116 | unsigned int n_mmaps_max;
|
---|
| 117 | -#if MALLOC_DEBUG
|
---|
| 118 | - unsigned int n_mmaps_cmax;
|
---|
| 119 | -#endif
|
---|
| 120 | unsigned long mmap_threshold;
|
---|
| 121 | int check_action;
|
---|
| 122 | unsigned long max_sbrked_mem;
|
---|
| 123 | @@ -553,9 +550,6 @@ public_gET_STATe(void)
|
---|
| 124 | ms->trim_threshold = mp_.trim_threshold;
|
---|
| 125 | ms->top_pad = mp_.top_pad;
|
---|
| 126 | ms->n_mmaps_max = mp_.n_mmaps_max;
|
---|
| 127 | -#if MALLOC_DEBUG
|
---|
| 128 | - ms->n_mmaps_cmax = mp_.n_mmaps_cmax;
|
---|
| 129 | -#endif
|
---|
| 130 | ms->mmap_threshold = mp_.mmap_threshold;
|
---|
| 131 | ms->check_action = check_action;
|
---|
| 132 | ms->max_sbrked_mem = main_arena.max_system_mem;
|
---|
| 133 | @@ -601,8 +595,9 @@ public_sET_STATe(Void_t* msptr)
|
---|
| 134 | assert(ms->av[2*i+3] == 0);
|
---|
| 135 | first(b) = last(b) = b;
|
---|
| 136 | } else {
|
---|
| 137 | - if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
|
---|
| 138 | - largebin_index(chunksize(ms->av[2*i+3]))==i)) {
|
---|
| 139 | + if(ms->version >= 3 &&
|
---|
| 140 | + (i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
|
---|
| 141 | + largebin_index(chunksize(ms->av[2*i+3]))==i))) {
|
---|
| 142 | first(b) = ms->av[2*i+2];
|
---|
| 143 | last(b) = ms->av[2*i+3];
|
---|
| 144 | /* Make sure the links to the bins within the heap are correct. */
|
---|
| 145 | @@ -622,14 +617,22 @@ public_sET_STATe(Void_t* msptr)
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
| 148 | }
|
---|
| 149 | + if (ms->version < 3) {
|
---|
| 150 | + /* Clear fd_nextsize and bk_nextsize fields. */
|
---|
| 151 | + b = unsorted_chunks(&main_arena)->fd;
|
---|
| 152 | + while (b != unsorted_chunks(&main_arena)) {
|
---|
| 153 | + if (!in_smallbin_range(chunksize(b))) {
|
---|
| 154 | + b->fd_nextsize = NULL;
|
---|
| 155 | + b->bk_nextsize = NULL;
|
---|
| 156 | + }
|
---|
| 157 | + b = b->fd;
|
---|
| 158 | + }
|
---|
| 159 | + }
|
---|
| 160 | mp_.sbrk_base = ms->sbrk_base;
|
---|
| 161 | main_arena.system_mem = ms->sbrked_mem_bytes;
|
---|
| 162 | mp_.trim_threshold = ms->trim_threshold;
|
---|
| 163 | mp_.top_pad = ms->top_pad;
|
---|
| 164 | mp_.n_mmaps_max = ms->n_mmaps_max;
|
---|
| 165 | -#if MALLOC_DEBUG
|
---|
| 166 | - mp_.n_mmaps_cmax = ms->n_mmaps_cmax;
|
---|
| 167 | -#endif
|
---|
| 168 | mp_.mmap_threshold = ms->mmap_threshold;
|
---|
| 169 | check_action = ms->check_action;
|
---|
| 170 | main_arena.max_system_mem = ms->max_sbrked_mem;
|
---|
| 171 | --- libc/malloc/Makefile.jj 2007-04-30 11:51:54.000000000 +0200
|
---|
| 172 | +++ libc/malloc/Makefile 2007-05-21 11:20:41.000000000 +0200
|
---|
| 173 | @@ -104,7 +104,6 @@ $(objpfx)memusagestat: $(memusagestat-mo
|
---|
| 174 | include ../Rules
|
---|
| 175 |
|
---|
| 176 | CFLAGS-mcheck-init.c = $(PIC-ccflag)
|
---|
| 177 | -CFLAGS-malloc.c += -DMALLOC_DEBUG
|
---|
| 178 |
|
---|
| 179 | $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
|
---|
| 180 | -rm -f $@
|
---|
| 181 |
|
---|
| 182 | Jakub
|
---|
| 183 |
|
---|