Lines Matching refs:size
37 * (minimum size is 64 bytes) are obtained from mmap() of 64K chunks
39 * The interface requires the caller to keep track of the size of an
40 * allocated block and to pass that size back when freeing a block.
59 * bucketnum allocation size
100 size_t size;
122 size = (size_t)MINSIZE << bucketnum;
123 n = SUBCHUNKSIZE / size;
129 void *next = (void *)((caddr_t)ptr + size);
153 getbucketnum(size_t size)
157 if (size-- <= MINSIZE)
161 if (size & 0xffffffff00000000ul)
162 highbit += 32, size >>= 32;
164 if (size & 0xffff0000)
165 highbit += 16, size >>= 16;
166 if (size & 0xff00)
167 highbit += 8, size >>= 8;
168 if (size & 0xf0)
169 highbit += 4, size >>= 4;
170 if (size & 0xc)
171 highbit += 2, size >>= 2;
172 if (size & 0x2)
180 lmalloc(size_t size)
182 int bucketnum = getbucketnum(size);
195 /* round size up to the proper power of 2 */
196 size = (size_t)MINSIZE << bucketnum;
200 ptr = mmap((void *)CHUNKSIZE, size, prot,
236 n = bsize / size;
250 void *next = (void *)((caddr_t)ptr + size);
270 lfree(void *ptr, size_t size)
272 int bucketnum = getbucketnum(size);
276 /* round size up to the proper power of 2 */
277 size = (size_t)MINSIZE << bucketnum;
283 (void) munmap(ptr, size);
295 if (((uintptr_t)ptr & (size - 1)) != 0)
301 (void) memset(ptr, 0, size);
322 * (where the size of the allocation is not remembered by the caller)
345 libc_malloc(size_t size)
349 size = (size_t)MINSIZE << getbucketnum(size + sizeof (*ptr));
350 if ((ptr = lmalloc(size)) == NULL)
352 ptr->private_size = size;
357 libc_realloc(void *old, size_t size)
362 size = (size_t)MINSIZE << getbucketnum(size + sizeof (*ptr));
363 if ((ptr = lmalloc(size)) == NULL)
365 ptr->private_size = size;
369 if (size >= ptr->private_size)
370 size = ptr->private_size;
371 (void) memcpy(new, old, size - sizeof (*ptr));