Lines Matching refs:av
1620 unlink_chunk (mstate av, mchunkptr p) in unlink_chunk() argument
1954 malloc_init_state (mstate av) in malloc_init_state() argument
1962 bin = bin_at (av, i); in malloc_init_state()
1967 if (av != &main_arena) in malloc_init_state()
1969 set_noncontiguous (av); in malloc_init_state()
1970 if (av == &main_arena) in malloc_init_state()
1972 atomic_store_relaxed (&av->have_fastchunks, false); in malloc_init_state()
1974 av->top = initial_top (av); in malloc_init_state()
2074 do_check_chunk (mstate av, mchunkptr p) in do_check_chunk() argument
2078 char *max_address = (char *) (av->top) + chunksize (av->top); in do_check_chunk()
2079 char *min_address = max_address - av->system_mem; in do_check_chunk()
2084 if (p != av->top) in do_check_chunk()
2086 if (contiguous (av)) in do_check_chunk()
2089 assert (((char *) p + sz) <= ((char *) (av->top))); in do_check_chunk()
2103 if (contiguous (av) && av->top != initial_top (av)) in do_check_chunk()
2119 do_check_free_chunk (mstate av, mchunkptr p) in do_check_free_chunk() argument
2124 do_check_chunk (av, p); in do_check_free_chunk()
2139 assert (next == av->top || inuse (next)); in do_check_free_chunk()
2154 do_check_inuse_chunk (mstate av, mchunkptr p) in do_check_inuse_chunk() argument
2158 do_check_chunk (av, p); in do_check_inuse_chunk()
2177 do_check_free_chunk (av, prv); in do_check_inuse_chunk()
2180 if (next == av->top) in do_check_inuse_chunk()
2186 do_check_free_chunk (av, next); in do_check_inuse_chunk()
2194 do_check_remalloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s) in do_check_remalloced_chunk() argument
2200 assert (av == arena_for_chunk (p)); in do_check_remalloced_chunk()
2202 assert (av == &main_arena); in do_check_remalloced_chunk()
2204 assert (av != &main_arena); in do_check_remalloced_chunk()
2207 do_check_inuse_chunk (av, p); in do_check_remalloced_chunk()
2224 do_check_malloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s) in do_check_malloced_chunk() argument
2227 do_check_remalloced_chunk (av, p, s); in do_check_malloced_chunk()
2255 do_check_malloc_state (mstate av) in do_check_malloc_state() argument
2273 assert (av->top != 0); in do_check_malloc_state()
2276 if (av->top == initial_top (av)) in do_check_malloc_state()
2283 if (av == &main_arena && contiguous (av)) in do_check_malloc_state()
2284 assert ((char *) mp_.sbrk_base + av->system_mem == in do_check_malloc_state()
2285 (char *) av->top + chunksize (av->top)); in do_check_malloc_state()
2296 p = fastbin (av, i); in do_check_malloc_state()
2310 if (av == &main_arena && i > max_fast_bin) in do_check_malloc_state()
2319 do_check_inuse_chunk (av, p); in do_check_malloc_state()
2330 b = bin_at (av, i); in do_check_malloc_state()
2335 unsigned int binbit = get_binmap (av, i); in do_check_malloc_state()
2346 do_check_free_chunk (av, p); in do_check_malloc_state()
2385 (q != av->top && inuse (q) && in do_check_malloc_state()
2388 do_check_inuse_chunk (av, q); in do_check_malloc_state()
2393 check_chunk (av, av->top); in do_check_malloc_state()
2414 sysmalloc_mmap (INTERNAL_SIZE_T nb, size_t pagesize, int extra_flags, mstate av) in sysmalloc_mmap() argument
2490 check_chunk (av, p); in sysmalloc_mmap()
2504 size_t pagesize, int extra_flags, mstate av) in sysmalloc_mmap_fallback() argument
2509 if (contiguous (av)) in sysmalloc_mmap_fallback()
2534 set_noncontiguous (av); in sysmalloc_mmap_fallback()
2541 sysmalloc (INTERNAL_SIZE_T nb, mstate av) in sysmalloc() argument
2573 if (av == NULL in sysmalloc()
2583 mm = sysmalloc_mmap (nb, mp_.hp_pagesize, mp_.hp_flags, av); in sysmalloc()
2588 mm = sysmalloc_mmap (nb, pagesize, 0, av); in sysmalloc()
2595 if (av == NULL) in sysmalloc()
2600 old_top = av->top; in sysmalloc()
2611 assert ((old_top == initial_top (av) && old_size == 0) || in sysmalloc()
2620 if (av != &main_arena) in sysmalloc()
2631 av->system_mem += old_heap->size - old_heap_size; in sysmalloc()
2638 heap->ar_ptr = av; in sysmalloc()
2640 av->system_mem += heap->size; in sysmalloc()
2642 top (av) = chunk_at_offset (heap, sizeof (*heap)); in sysmalloc()
2643 set_head (top (av), (heap->size - sizeof (*heap)) | PREV_INUSE); in sysmalloc()
2659 _int_free (av, old_top, 1); in sysmalloc()
2672 char *mm = sysmalloc_mmap (nb, pagesize, 0, av); in sysmalloc()
2689 if (contiguous (av)) in sysmalloc()
2743 mp_.hp_flags, av); in sysmalloc()
2747 MMAP_AS_MORECORE_SIZE, 0, av); in sysmalloc()
2760 av->system_mem += size; in sysmalloc()
2769 else if (contiguous (av) && old_size && brk < old_end) in sysmalloc()
2800 if (contiguous (av)) in sysmalloc()
2804 av->system_mem += brk - old_end; in sysmalloc()
2889 av->top = (mchunkptr) aligned_brk; in sysmalloc()
2890 set_head (av->top, (snd_brk - aligned_brk + correction) | PREV_INUSE); in sysmalloc()
2891 av->system_mem += correction; in sysmalloc()
2927 _int_free (av, old_top, 1); in sysmalloc()
2935 if ((unsigned long) av->system_mem > (unsigned long) (av->max_system_mem)) in sysmalloc()
2936 av->max_system_mem = av->system_mem; in sysmalloc()
2937 check_malloc_state (av); in sysmalloc()
2940 p = av->top; in sysmalloc()
2948 av->top = remainder; in sysmalloc()
2949 set_head (p, nb | PREV_INUSE | (av != &main_arena ? NON_MAIN_ARENA : 0)); in sysmalloc()
2951 check_malloced_chunk (av, p, nb); in sysmalloc()
2971 systrim (size_t pad, mstate av) in systrim() argument
2980 top_size = chunksize (av->top); in systrim()
3002 if (current_brk == (char *) (av->top) + top_size) in systrim()
3026 av->system_mem -= released; in systrim()
3027 set_head (av->top, (top_size - released) | PREV_INUSE); in systrim()
3028 check_malloc_state (av); in systrim()
3620 mstate av; in __libc_calloc() local
3643 av = &main_arena; in __libc_calloc()
3645 arena_get (av, sz); in __libc_calloc()
3647 if (av) in __libc_calloc()
3652 oldtop = top (av); in __libc_calloc()
3653 oldtopsize = chunksize (top (av)); in __libc_calloc()
3656 if (av == &main_arena && in __libc_calloc()
3657 oldtopsize < mp_.sbrk_base + av->max_system_mem - (char *) oldtop) in __libc_calloc()
3658 oldtopsize = (mp_.sbrk_base + av->max_system_mem - (char *) oldtop); in __libc_calloc()
3660 if (av != &main_arena) in __libc_calloc()
3674 mem = _int_malloc (av, sz); in __libc_calloc()
3677 av == arena_for_chunk (mem2chunk (mem))); in __libc_calloc()
3681 if (mem == 0 && av != NULL) in __libc_calloc()
3684 av = arena_get_retry (av, sz); in __libc_calloc()
3685 mem = _int_malloc (av, sz); in __libc_calloc()
3688 if (av != NULL) in __libc_calloc()
3689 __libc_lock_unlock (av->mutex); in __libc_calloc()
3765 _int_malloc (mstate av, size_t bytes) in _int_malloc() argument
3807 if (__glibc_unlikely (av == NULL)) in _int_malloc()
3809 void *p = sysmalloc (nb, av); in _int_malloc()
3837 mfastbinptr *fb = &fastbin (av, idx); in _int_malloc()
3855 check_remalloced_chunk (av, victim, nb); in _int_malloc()
3900 bin = bin_at (av, idx); in _int_malloc()
3911 if (av != &main_arena) in _int_malloc()
3913 check_malloced_chunk (av, victim, nb); in _int_malloc()
3930 if (av != &main_arena) in _int_malloc()
3960 if (atomic_load_relaxed (&av->have_fastchunks)) in _int_malloc()
3961 malloc_consolidate (av); in _int_malloc()
3990 while ((victim = unsorted_chunks (av)->bk) != unsorted_chunks (av)) in _int_malloc()
3997 || __glibc_unlikely (size > av->system_mem)) in _int_malloc()
4000 || __glibc_unlikely (chunksize_nomask (next) > av->system_mem)) in _int_malloc()
4005 || __glibc_unlikely (victim->fd != unsorted_chunks (av))) in _int_malloc()
4019 bck == unsorted_chunks (av) && in _int_malloc()
4020 victim == av->last_remainder && in _int_malloc()
4026 unsorted_chunks (av)->bk = unsorted_chunks (av)->fd = remainder; in _int_malloc()
4027 av->last_remainder = remainder; in _int_malloc()
4028 remainder->bk = remainder->fd = unsorted_chunks (av); in _int_malloc()
4036 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_malloc()
4040 check_malloced_chunk (av, victim, nb); in _int_malloc()
4049 unsorted_chunks (av)->bk = bck; in _int_malloc()
4050 bck->fd = unsorted_chunks (av); in _int_malloc()
4057 if (av != &main_arena) in _int_malloc()
4072 check_malloced_chunk (av, victim, nb); in _int_malloc()
4086 bck = bin_at (av, victim_index); in _int_malloc()
4092 bck = bin_at (av, victim_index); in _int_malloc()
4143 mark_bin (av, victim_index); in _int_malloc()
4181 bin = bin_at (av, idx); in _int_malloc()
4201 unlink_chunk (av, victim); in _int_malloc()
4207 if (av != &main_arena) in _int_malloc()
4216 bck = unsorted_chunks (av); in _int_malloc()
4230 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_malloc()
4234 check_malloced_chunk (av, victim, nb); in _int_malloc()
4253 bin = bin_at (av, idx); in _int_malloc()
4255 map = av->binmap[block]; in _int_malloc()
4268 while ((map = av->binmap[block]) == 0); in _int_malloc()
4270 bin = bin_at (av, (block << BINMAPSHIFT)); in _int_malloc()
4288 av->binmap[block] = map &= ~bit; /* Write through */ in _int_malloc()
4303 unlink_chunk (av, victim); in _int_malloc()
4309 if (av != &main_arena) in _int_malloc()
4320 bck = unsorted_chunks (av); in _int_malloc()
4331 av->last_remainder = remainder; in _int_malloc()
4338 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_malloc()
4342 check_malloced_chunk (av, victim, nb); in _int_malloc()
4365 victim = av->top; in _int_malloc()
4368 if (__glibc_unlikely (size > av->system_mem)) in _int_malloc()
4375 av->top = remainder; in _int_malloc()
4377 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_malloc()
4380 check_malloced_chunk (av, victim, nb); in _int_malloc()
4388 else if (atomic_load_relaxed (&av->have_fastchunks)) in _int_malloc()
4390 malloc_consolidate (av); in _int_malloc()
4403 void *p = sysmalloc (nb, av); in _int_malloc()
4416 _int_free (mstate av, mchunkptr p, int have_lock) in _int_free() argument
4441 check_inuse_chunk(av, p); in _int_free()
4496 && (chunk_at_offset(p, size) != av->top) in _int_free()
4503 >= av->system_mem, 0)) in _int_free()
4511 __libc_lock_lock (av->mutex); in _int_free()
4513 || chunksize (chunk_at_offset (p, size)) >= av->system_mem); in _int_free()
4514 __libc_lock_unlock (av->mutex); in _int_free()
4523 atomic_store_relaxed (&av->have_fastchunks, true); in _int_free()
4525 fb = &fastbin (av, idx); in _int_free()
4572 __libc_lock_lock (av->mutex); in _int_free()
4578 if (__glibc_unlikely (p == av->top)) in _int_free()
4581 if (__builtin_expect (contiguous (av) in _int_free()
4583 >= ((char *) av->top + chunksize(av->top)), 0)) in _int_free()
4591 || __builtin_expect (nextsize >= av->system_mem, 0)) in _int_free()
4603 unlink_chunk (av, p); in _int_free()
4606 if (nextchunk != av->top) { in _int_free()
4612 unlink_chunk (av, nextchunk); in _int_free()
4623 bck = unsorted_chunks(av); in _int_free()
4640 check_free_chunk(av, p); in _int_free()
4651 av->top = p; in _int_free()
4652 check_chunk(av, p); in _int_free()
4669 if (atomic_load_relaxed (&av->have_fastchunks)) in _int_free()
4670 malloc_consolidate(av); in _int_free()
4672 if (av == &main_arena) { in _int_free()
4674 if ((unsigned long)(chunksize(av->top)) >= in _int_free()
4676 systrim(mp_.top_pad, av); in _int_free()
4681 heap_info *heap = heap_for_ptr(top(av)); in _int_free()
4683 assert(heap->ar_ptr == av); in _int_free()
4689 __libc_lock_unlock (av->mutex); in _int_free()
4710 static void malloc_consolidate(mstate av) in malloc_consolidate() argument
4726 atomic_store_relaxed (&av->have_fastchunks, false); in malloc_consolidate()
4728 unsorted_bin = unsorted_chunks(av); in malloc_consolidate()
4738 maxfb = &fastbin (av, NFASTBINS - 1); in malloc_consolidate()
4739 fb = &fastbin (av, 0); in malloc_consolidate()
4750 if ((&fastbin (av, idx)) != fb) in malloc_consolidate()
4754 check_inuse_chunk(av, p); in malloc_consolidate()
4768 unlink_chunk (av, p); in malloc_consolidate()
4771 if (nextchunk != av->top) { in malloc_consolidate()
4776 unlink_chunk (av, nextchunk); in malloc_consolidate()
4798 av->top = p; in malloc_consolidate()
4812 _int_realloc (mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize, in _int_realloc() argument
4826 || __builtin_expect (oldsize >= av->system_mem, 0)) in _int_realloc()
4829 check_inuse_chunk (av, oldp); in _int_realloc()
4837 || __builtin_expect (nextsize >= av->system_mem, 0)) in _int_realloc()
4850 if (next == av->top && in _int_realloc()
4854 set_head_size (oldp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_realloc()
4855 av->top = chunk_at_offset (oldp, nb); in _int_realloc()
4856 set_head (av->top, (newsize - nb) | PREV_INUSE); in _int_realloc()
4857 check_inuse_chunk (av, oldp); in _int_realloc()
4862 else if (next != av->top && in _int_realloc()
4868 unlink_chunk (av, next); in _int_realloc()
4874 newmem = _int_malloc (av, nb - MALLOC_ALIGN_MASK); in _int_realloc()
4896 _int_free (av, oldp, 1); in _int_realloc()
4897 check_inuse_chunk (av, newp); in _int_realloc()
4911 set_head_size (newp, newsize | (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_realloc()
4919 set_head_size (newp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_realloc()
4921 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_realloc()
4924 _int_free (av, remainder, 1); in _int_realloc()
4927 check_inuse_chunk (av, newp); in _int_realloc()
4936 _int_memalign (mstate av, size_t alignment, size_t bytes) in _int_memalign() argument
4965 m = (char *) (_int_malloc (av, nb + alignment + MINSIZE)); in _int_memalign()
5000 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_memalign()
5002 set_head_size (p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_memalign()
5003 _int_free (av, p, 1); in _int_memalign()
5019 (av != &main_arena ? NON_MAIN_ARENA : 0)); in _int_memalign()
5021 _int_free (av, remainder, 1); in _int_memalign()
5025 check_inuse_chunk (av, p); in _int_memalign()
5035 mtrim (mstate av, size_t pad) in mtrim() argument
5038 malloc_consolidate (av); in mtrim()
5048 mbinptr bin = bin_at (av, i); in mtrim()
5084 return result | (av == &main_arena ? systrim (pad, av) : 0); in mtrim()
5147 int_mallinfo (mstate av, struct mallinfo2 *m) in int_mallinfo() argument
5157 check_malloc_state (av); in int_mallinfo()
5160 avail = chunksize (av->top); in int_mallinfo()
5169 for (p = fastbin (av, i); in int_mallinfo()
5186 b = bin_at (av, i); in int_mallinfo()
5197 m->uordblks += av->system_mem - avail; in int_mallinfo()
5198 m->arena += av->system_mem; in int_mallinfo()
5200 if (av == &main_arena) in int_mallinfo()
5205 m->keepcost = chunksize (av->top); in int_mallinfo()
5448 mstate av = &main_arena; in __libc_mallopt() local
5453 __libc_lock_lock (av->mutex); in __libc_mallopt()
5459 malloc_consolidate (av); in __libc_mallopt()
5507 __libc_lock_unlock (av->mutex); in __libc_mallopt()