Lines Matching refs:size
48 * contains all elts of the same size. The tree is ordered by size.
53 * The header of a block contains the size of the data part in bytes.
54 * Since the size of a block is 0%4, the low two bits of the header
94 #define FREESIZE (1<<5) /* size for preserving free blocks until next malloc */
121 _smalloc(size_t size)
126 ASSERT(size % WORDSIZE == 0);
128 if (size == 0)
129 size = WORDSIZE;
132 i = size / WORDSIZE - 1;
139 ASSERT((size + WORDSIZE) * NPS >= MINSIZE);
142 if ((List[i] = _malloc_unlocked((size + WORDSIZE) * NPS)) == 0)
148 SIZE(tp) = size;
163 malloc(size_t size)
173 ret = _malloc_unlocked(size);
179 _malloc_unlocked(size_t size)
188 /* check for size that could overflow calculations */
189 if (size > MAX_MALLOC) {
194 /* make sure that size is 0 mod ALIGN */
195 ROUND(size);
202 if (n == size) {
210 } else if (size >= MINSIZE && n > size) {
228 if (size < MINSIZE)
229 return (_smalloc(size));
231 /* search for an elt of the right size */
238 if (SIZE(tp) >= size) {
266 if (Bottom && size <= SIZE(Bottom)) {
269 } else if ((sp = _morecore(size)) == NULL) /* no more memory */
280 if ((n = (SIZE(sp) - size)) >= MINSIZE + WORDSIZE) {
282 SIZE(sp) = size;
298 * If the block size is increasing, we try forward merging first.
302 realloc(void *old, size_t size)
316 /* check for size that could overflow calculations */
317 if (size > MAX_MALLOC) {
325 new = _malloc_unlocked(size);
333 /* make sure that size is 0 mod ALIGN */
334 ROUND(size);
347 if (size == SIZE(tp)) {
354 if (size < MINSIZE || SIZE(tp) < MINSIZE) {
355 /* free is size is zero */
356 if (size == 0) {
366 /* block is increasing in size, try merging the next block */
367 if (size > SIZE(tp)) {
382 if (size > SIZE(tp) && BOTTOM(tp) && GETCORE(0) == Baddr) {
384 if ((tp = _morecore(size)) == NULL) {
393 if (size <= SIZE(tp)) {
397 if ((n = (SIZE(tp) - size)) >= MINSIZE + WORDSIZE) {
399 SIZE(tp) = size;
415 if ((new = _malloc_unlocked(size)) != NULL) {
417 if (ts > size)
418 ts = size;
428 * 1. size <= SIZE(tp) < MINSIZE
430 * 2. SIZE(tp) < size < MINSIZE
433 * 3. size < MINSIZE <= SIZE(tp)
437 * 4. MINSIZE <= SIZE(tp) < size
439 * these two blocks has at least size bytes, then merge
444 if (size < SIZE(tp)) { /* case 1. */
448 } else if (size < MINSIZE) { /* case 2. */
449 size = MINSIZE;
452 } else if (size < MINSIZE) { /* case 3. */
453 size = MINSIZE;
456 (SIZE(np = LAST(tp)) + SIZE(tp) + WORDSIZE) >= size) {
491 size_t ts, size;
541 size = SIZE(tp);
544 if (SIZE(np) > size) {
552 } else if (SIZE(np) < size) {
601 _morecore(size_t size)
610 n = (ssize_t)size + 2 * WORDSIZE;
616 /* need to pad size out so that addr is aligned */