Lines Matching refs:ptr
380 static void free_to_os(void* ptr, size_t size) {
381 DEBUG_ASSERT(IS_PAGE_ALIGNED(ptr));
383 heap_page_free(ptr, size >> PAGE_SIZE_SHIFT);
465 static void check_free_fill(void* ptr, size_t size) {
470 uint8_t byte = ((uint8_t*)ptr)[i];
474 hexdump8(ptr, size);
748 void* ptr[16];
750 ptr[0] = cmpct_alloc(8);
751 ptr[1] = cmpct_alloc(32);
752 ptr[2] = cmpct_alloc(7);
754 ptr[3] = cmpct_alloc(0);
755 ptr[4] = cmpct_alloc(98713);
756 ptr[5] = cmpct_alloc(16);
758 cmpct_free(ptr[5]);
759 cmpct_free(ptr[1]);
760 cmpct_free(ptr[3]);
761 cmpct_free(ptr[0]);
762 cmpct_free(ptr[4]);
763 cmpct_free(ptr[2]);
771 ptr[i] = 0;
781 if (ptr[index]) {
782 // printf("freeing ptr[0x%x] = %p\n", index, ptr[index]);
783 cmpct_free(ptr[index]);
784 ptr[index] = 0;
787 ptr[index] = cmpct_memalign((unsigned int)rand() % 32768, align);
788 // printf("ptr[0x%x] = %p, align 0x%x\n", index, ptr[index], align);
790 DEBUG_ASSERT(((addr_t)ptr[index] % align) == 0);
795 if (ptr[i]) {
796 cmpct_free(ptr[i]);
1080 void* ptr = NULL;
1087 ptr = os_alloc;
1089 DEBUG_ASSERT_MSG(IS_PAGE_ALIGNED(ptr),
1090 "0x%zx bytes @%p", size, ptr);
1092 "0x%zx bytes @%p", size, ptr);
1104 if (ptr == NULL) {
1105 ptr = heap_page_alloc(size >> PAGE_SIZE_SHIFT);
1106 if (ptr == NULL) {
1109 LTRACEF("Growing heap by 0x%zx bytes, new ptr %p\n", size, ptr);
1113 add_to_heap(ptr, size);