Lines Matching refs:size

38  * (minimum size is 64 bytes) are obtained from mmap() of 64K chunks
40 * The interface requires the caller to keep track of the size of an
41 * allocated block and to pass that size back when freeing a block.
60 * bucketnum allocation size
101 size_t size;
123 size = (size_t)MINSIZE << bucketnum;
124 n = SUBCHUNKSIZE / size;
130 void *next = (void *)((caddr_t)ptr + size);
154 getbucketnum(size_t size)
158 if (size-- <= MINSIZE)
162 if (size & 0xffffffff00000000ul)
163 highbit += 32, size >>= 32;
165 if (size & 0xffff0000)
166 highbit += 16, size >>= 16;
167 if (size & 0xff00)
168 highbit += 8, size >>= 8;
169 if (size & 0xf0)
170 highbit += 4, size >>= 4;
171 if (size & 0xc)
172 highbit += 2, size >>= 2;
173 if (size & 0x2)
181 lmalloc(size_t size)
183 int bucketnum = getbucketnum(size);
196 /* round size up to the proper power of 2 */
197 size = (size_t)MINSIZE << bucketnum;
201 ptr = mmap((void *)CHUNKSIZE, size, prot,
237 n = bsize / size;
251 void *next = (void *)((caddr_t)ptr + size);
271 lfree(void *ptr, size_t size)
273 int bucketnum = getbucketnum(size);
277 /* round size up to the proper power of 2 */
278 size = (size_t)MINSIZE << bucketnum;
284 (void) munmap(ptr, size);
296 if (((uintptr_t)ptr & (size - 1)) != 0)
302 (void) memset(ptr, 0, size);
323 * (where the size of the allocation is not remembered by the caller)
346 libc_malloc(size_t size)
350 size = (size_t)MINSIZE << getbucketnum(size + sizeof (*ptr));
351 if ((ptr = lmalloc(size)) == NULL)
353 ptr->private_size = size;
358 libc_realloc(void *old, size_t size)
363 size = (size_t)MINSIZE << getbucketnum(size + sizeof (*ptr));
364 if ((ptr = lmalloc(size)) == NULL)
366 ptr->private_size = size;
370 if (size >= ptr->private_size)
371 size = ptr->private_size;
372 (void) memcpy(new, old, size - sizeof (*ptr));