Lines Matching refs:size

46  *	contains all elts of the same size. The tree is ordered by size.
51 * The header of a block contains the size of the data part in bytes.
52 * Since the size of a block is 0%4, the low two bits of the header
113 smalloc(size_t size)
118 ASSERT(size % WORDSIZE == 0);
120 if (size == 0)
121 size = WORDSIZE;
124 i = size / WORDSIZE - 1;
129 ASSERT((size + WORDSIZE) * NPS >= MINSIZE);
132 if ((np = malloc_unlocked((size + WORDSIZE)*NPS)) == NULL)
138 SIZE(tp) = size;
164 malloc(size_t size)
168 ret = malloc_unlocked(size);
174 malloc_unlocked(size_t size)
182 /* check for size that could overflow calculations */
183 if (size > MAX_MALLOC) {
187 /* make sure that size is 0 mod ALIGN */
188 ROUND(size);
191 if (size < MINSIZE)
192 return (smalloc(size));
194 /* search for an elt of the right size */
201 if (SIZE(tp) >= size) { /* branch left */
240 if (size <= SIZE(Bottom)) {
245 if ((sp = morecore(size)) == NULL)
249 if ((sp = morecore(size)) == NULL)
264 if ((n = (SIZE(sp) - size)) >= MINSIZE + WORDSIZE) {
266 SIZE(sp) = size;
283 * If the block size is increasing, we try forward merging first.
287 realloc(void *old, size_t size)
295 /* check for size that could overflow calculations */
296 if (size > MAX_MALLOC) {
304 new = malloc_unlocked(size);
309 /* make sure that size is 0 mod ALIGN */
310 ROUND(size);
327 if (size == SIZE(tp)) { /* nothing to do */
335 if (size < MINSIZE || SIZE(tp) < MINSIZE) {
336 if (size == 0) {
345 /* block is increasing in size, try merging the next block */
346 if (size > SIZE(tp)) {
369 if (size > SIZE(tp) && BOTTOM(tp) && GETCORE(0) == Baddr) {
372 if ((tp = morecore(size)) == NULL) {
381 if (size <= SIZE(tp)) {
384 if ((n = (SIZE(tp) - size)) >= MINSIZE + WORDSIZE) {
386 SIZE(tp) = size;
403 if ((new = malloc_unlocked(size)) != NULL) {
405 if (ts > size)
406 ts = size;
416 * 1. size <= SIZE(tp) < MINSIZE
418 * 2. SIZE(tp) < size < MINSIZE
421 * 3. size < MINSIZE <= SIZE(tp)
425 * 4. MINSIZE <= SIZE(tp) < size
427 * these two blocks has at least size bytes, then merge
432 if (size < SIZE(tp)) /* case 1. */ {
437 } else if (size < MINSIZE) /* case 2. */ {
438 size = MINSIZE;
441 } else if (size < MINSIZE) /* case 3. */ {
442 size = MINSIZE;
447 if ((SIZE(np) + SIZE(tp) + WORDSIZE) >= size) {
483 size_t ts, size;
551 size = SIZE(tp);
555 if (SIZE(np) > size) {
565 } else if (SIZE(np) < size) {
635 morecore(size_t size)
643 n = size + 2 * WORDSIZE;
650 /* need to pad size out so that addr is aligned */
1096 * Returns a block of specified size on a specified alignment boundary.
1115 #define nextblk(p, size) ((TREE *)((char *)(p) + (size)))
1123 size_t blksize; /* Current (shrinking) block size */
1126 size_t frag_size; /* size of fragments fore and aft */
1130 * check for valid size and alignment parameters
1143 * fragment of minimum size cannot be created. In order to
1145 * alignment to be at least as large as the minimum frag size
1149 /* check for size that could overflow ROUND calculation */
1174 * get size of the entire block (overhead and all)
1250 valloc(size_t size)
1255 return (memalign(pagesize, size));
1259 calloc(size_t num, size_t size)
1264 total = num * size;
1267 if (num != 0 && total / num != size) {
1278 cfree(void *p, size_t num, size_t size)
1407 size_t size, sz;
1414 sz = size = SIZE(tp);
1415 CLRBITS01(size);
1416 if (size == 0)
1419 size = 0;
1422 ctl.prwatch.pr_size = size + WORDSIZE;
1439 ctl.prwatch.pr_size = WORDSIZE; /* size is arbitrary */