Lines Matching defs:size

35     /* >Compare a large size with a small size */
36 /* >Compare a small size with a large size */
41 block1->internals.heap_block.size = 1200;
43 block2->internals.heap_block.size = 1600;
45 block3->internals.heap_block.size = 1600;
88 size_t size = 50;
120 manager->size = 10 * PICO_MEM_PAGE_SIZE;
127 block->internals.heap_block.size = 100;
129 sizeLeft -= block->internals.heap_block.size;
131 byteptr += block->internals.heap_block.size;
133 /* First block in extra manager page, unusable due to too small size */
138 block->internals.heap_block.size = (uint32_t)(size / 2);
140 sizeLeft -= block->internals.heap_block.size;
142 byteptr += block->internals.heap_block.size;
144 /* Second block in extra manager page, free with more than enough size */
148 block->internals.heap_block.size = (uint32_t)(100 - size / 2);
150 sizeLeft -= block->internals.heap_block.size;
153 byteptr += block->internals.heap_block.size;
160 block->internals.heap_block.size = (uint32_t)(sizeLeft - 2 * sizeof(struct pico_mem_block) - size);
162 sizeLeft -= block->internals.heap_block.size;
164 byteptr += block->internals.heap_block.size;
167 /* Fourth block in extra manager page, free, large enough size */
171 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
174 data0 = _pico_mem_manager_extra_alloc(heap_page, size);
176 data1 = _pico_mem_manager_extra_alloc(heap_page, size);
178 manager->size = 2 * PICO_MEM_PAGE_SIZE;
180 data2 = _pico_mem_manager_extra_alloc(heap_page, size);
183 manager->size = 10 * PICO_MEM_PAGE_SIZE;
185 data2 = _pico_mem_manager_extra_alloc(heap_page, size);
190 data3 = _pico_mem_manager_extra_alloc(heap_page2, size);
199 ck_assert(block->internals.heap_block.size == 100 - size / 2);
205 ck_assert(block->internals.heap_block.size == size);
217 ck_assert(block->internals.heap_block.size == size);
220 sizeLeft -= block->internals.heap_block.size;
222 byteptr += block->internals.heap_block.size;
227 ck_assert(block->internals.heap_block.size == size);
230 sizeLeft -= block->internals.heap_block.size;
232 byteptr += block->internals.heap_block.size;
237 ck_assert(block->internals.heap_block.size == sizeLeft - sizeof(struct pico_mem_block));
274 block->internals.heap_block.size = (uint32_t)size1;
276 byteptr += block->internals.heap_block.size;
278 sizeLeft -= block->internals.heap_block.size;
283 block->internals.heap_block.size = (uint32_t)(size1 / 2);
285 byteptr += block->internals.heap_block.size;
287 sizeLeft -= block->internals.heap_block.size;
292 block->internals.heap_block.size = (uint32_t)size1;
294 byteptr += block->internals.heap_block.size;
296 sizeLeft -= block->internals.heap_block.size;
301 block->internals.heap_block.size = (uint32_t)(size1 * 2);
303 byteptr += block->internals.heap_block.size;
305 sizeLeft -= block->internals.heap_block.size;
310 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
323 byteptr += block->internals.heap_block.size;
327 byteptr += block->internals.heap_block.size;
331 byteptr += block->internals.heap_block.size;
335 byteptr += block->internals.heap_block.size;
339 byteptr += block->internals.heap_block.size;
342 ck_assert(block->internals.heap_block.size == sizeLeft - sizeof(struct pico_mem_block));
348 ck_assert(block->internals.heap_block.size == sizeLeft - sizeof(struct pico_mem_block));
360 manager->size = 10 * PICO_MEM_PAGE_SIZE;
368 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
371 manager->size = PICO_MEM_PAGE_SIZE;
376 manager->size = 10 * PICO_MEM_PAGE_SIZE;
394 ck_assert(block->internals.heap_block.size == size1);
401 ck_assert(block->internals.heap_block.size == size1);
434 manager->size = 10 * PICO_MEM_PAGE_SIZE;
444 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block);
450 /* Slabsize 975 => 4 slab blocks fit in the page with 44 heap size */
451 /* with a minimum heap size of 100, one slab block will be used as heapspace */
568 manager->size = 3 * PICO_MEM_PAGE_SIZE;
578 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block) - (sizeof(struct pico_mem_block) + sizeof(struct pico_tree_node)) - (sizeof(struct pico_mem_block) + sizeof(struct pico_mem_slab_node));
580 byteptr += block->internals.heap_block.size;
584 block->internals.heap_block.size = sizeof(struct pico_mem_slab_node);
587 byteptr += block->internals.heap_block.size;
591 block->internals.heap_block.size = sizeof(struct pico_tree_node);
655 ck_assert(manager->size == 10 * PICO_MEM_PAGE_SIZE);
677 uint16_t size = 50;
707 block->internals.heap_block.size = size;
709 byteptr += block->internals.heap_block.size;
711 sizeLeft -= block->internals.heap_block.size;
717 block->internals.heap_block.size = size;
719 byteptr += block->internals.heap_block.size;
721 sizeLeft -= block->internals.heap_block.size;
727 block->internals.heap_block.size = size;
729 byteptr += block->internals.heap_block.size;
731 sizeLeft -= block->internals.heap_block.size;
737 block->internals.heap_block.size = size;
739 byteptr += block->internals.heap_block.size;
741 sizeLeft -= block->internals.heap_block.size;
747 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
750 byteptr += block->internals.heap_block.size;
760 ck_assert(block1->internals.heap_block.size == size);
766 ck_assert(block1->internals.heap_block.size == sizeof(struct pico_mem_block) + (size_t)(2 * size));
772 ck_assert(block4->internals.heap_block.size == sizeof(struct pico_mem_block) + size + sizeLeft);
778 ck_assert(block1->internals.heap_block.size == page->heap_max_size);
779 /* printf("page->heap_max_size=%u ?= block1.size=%u\n", page->heap_max_size, block1->internals.heap_block.size); */
796 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block) - 2 * (sizeof(struct pico_mem_block) + size));
798 byteptr += block->internals.heap_block.size;
800 sizeLeft -= block->internals.heap_block.size;
806 block->internals.heap_block.size = size;
808 byteptr += block->internals.heap_block.size;
810 sizeLeft -= block->internals.heap_block.size;
816 block->internals.heap_block.size = size;
818 byteptr += block->internals.heap_block.size;
820 sizeLeft -= block->internals.heap_block.size;
831 ck_assert(block3->internals.heap_block.size == size);
837 ck_assert(block2->internals.heap_block.size == size + sizeof(struct pico_mem_block) + size);
843 ck_assert(block1->internals.heap_block.size == page->heap_max_free_space);
854 uint16_t size = 50;
865 /* Scenario's to test: Structure: |size 50 f|size 100 nf|size 25 f|size 75 nf|nf|slabs */
866 /* block4 with size 100 becomes f, previous max free size 50 */
873 page->heap_max_free_space = size;
881 block->internals.heap_block.size = size;
883 byteptr += block->internals.heap_block.size;
885 sizeLeft -= block->internals.heap_block.size;
891 block->internals.heap_block.size = (uint32_t)(2 * size);
893 byteptr += block->internals.heap_block.size;
895 sizeLeft -= block->internals.heap_block.size;
901 block->internals.heap_block.size = size / 2;
903 byteptr += block->internals.heap_block.size;
905 sizeLeft -= block->internals.heap_block.size;
911 block->internals.heap_block.size = (uint32_t)(3 * size / 2);
913 byteptr += block->internals.heap_block.size;
915 sizeLeft -= block->internals.heap_block.size;
921 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
924 byteptr += block->internals.heap_block.size;
930 ck_assert(page->heap_max_free_space == size);
932 ck_assert(page->heap_max_free_space == 3 * size / 2);
959 uint32_t size = 900;
980 manager->size = 10 * PICO_MEM_PAGE_SIZE;
989 page1->slab_size = size;
992 lenptr = &size;
999 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block);
1001 /* Page 0: one slab free (slab_node exists in tree, for this size) */
1022 /* Page 1: all slabs not free, this one will be freed (no node in the tree for this size) */
1063 manager->size = 2 * PICO_MEM_PAGE_SIZE;
1073 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block) - (sizeof(struct pico_mem_block) + sizeof(struct pico_mem_slab_node));
1075 byteptr += block->internals.heap_block.size;
1079 block->internals.heap_block.size = sizeof(struct pico_mem_slab_node);
1099 block->internals.heap_block.size = sizeof(struct pico_mem_slab_node) - 1;
1120 size_t size = 100;
1134 bytestream = pico_zalloc(size);
1135 memset(bytestream, 'a', size);
1137 _pico_mem_zero_initialize(bytestream + leftBound, size - leftBound - rightBound);
1138 for(i = 0; i < size; i++)
1140 if(i < leftBound || i >= size - rightBound)
1154 ck_assert(initialized == size - leftBound - rightBound);
1165 uint16_t size = 50;
1180 /* Scenario's to test: Structure: [size 25 f| size 50 nf | size 60 f | size 50 nf | free space] */
1198 block->internals.heap_block.size = size / 2;
1200 byteptr += block->internals.heap_block.size;
1202 sizeLeft -= block->internals.heap_block.size;
1207 block->internals.heap_block.size = size;
1209 byteptr += block->internals.heap_block.size;
1211 sizeLeft -= block->internals.heap_block.size;
1216 block->internals.heap_block.size = (uint32_t)(size + size / 5);
1217 block2Size = block->internals.heap_block.size;
1219 byteptr += block->internals.heap_block.size;
1221 sizeLeft -= block->internals.heap_block.size;
1227 block->internals.heap_block.size = size;
1229 byteptr += block->internals.heap_block.size;
1231 sizeLeft -= block->internals.heap_block.size;
1236 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
1239 byteptr += block->internals.heap_block.size;
1248 startOfData1 = _pico_mem_find_heap_block(page, size);
1249 startOfData2 = _pico_mem_find_heap_block(page, size);
1255 ck_assert(block2->internals.heap_block.size == block2Size);
1260 ck_assert(block4->internals.heap_block.size == size);
1264 byteptr += block4->internals.heap_block.size;
1265 sizeLeft -= block4->internals.heap_block.size;
1269 ck_assert(block->internals.heap_block.size == sizeLeft - sizeof(struct pico_mem_block));
1279 uint32_t size = 900;
1296 /* >The size you request has no slab_nodes available, it returns NULL */
1297 /* >The size you request has multiple slab nodes available, it returns one */
1298 /* >The size you request has one slab node available, it returns it and deletes the tree_node */
1304 manager->size = 10 * PICO_MEM_PAGE_SIZE;
1315 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block);
1345 /* Find slab with a size for which no tree_node exists */
1346 noData = _pico_mem_find_slab(size);
1376 uint32_t size = 50;
1399 manager->size = 10 * PICO_MEM_PAGE_SIZE;
1409 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block);
1453 block->internals.heap_block.size = size;
1455 byteptr += block->internals.heap_block.size;
1457 sizeLeft1 -= block->internals.heap_block.size;
1463 block->internals.heap_block.size = (uint32_t)(sizeLeft1 - sizeof(struct pico_mem_block));
1466 byteptr += block->internals.heap_block.size;
1472 block->internals.heap_block.size = size;
1474 byteptr += block->internals.heap_block.size;
1476 sizeLeft2 -= block->internals.heap_block.size;
1482 block->internals.heap_block.size = (uint32_t)(sizeLeft2 - sizeof(struct pico_mem_block));
1485 byteptr += block->internals.heap_block.size;
1496 ck_assert(block1->internals.heap_block.size != size);
1503 ck_assert(block2->internals.heap_block.size != size);
1521 /* 1: Asking for another slabsize 3 times => switch slab size */
1522 /* 2: Asking for a bigger slab size => return the bigger slab size, but don't switch the default yet */
1523 /* 3: After 3 times, switch the size again */
1620 uint32_t size = 50;
1644 /* >7: Another default slabsize; a new page must be created with this size */
1645 /* >8: Request for a heap size of less than the minimum object size must still result in an allocation of the minimum object size */
1656 manager->size = 3 * PICO_MEM_PAGE_SIZE;
1666 block->internals.heap_block.size = PICO_MEM_PAGE_SIZE - sizeof(struct pico_mem_manager) - sizeof(struct pico_mem_block);
1685 block->internals.heap_block.size = size;
1687 byteptr += block->internals.heap_block.size;
1689 sizeLeft1 -= block->internals.heap_block.size;
1694 block->internals.heap_block.size = (uint32_t)(sizeLeft1 - sizeof(struct pico_mem_block));
1697 byteptr += block->internals.heap_block.size;
1751 manager->size += PICO_MEM_PAGE_SIZE;
1770 manager->size += 3 * PICO_MEM_PAGE_SIZE;
1780 /* At this point, a new page should be created with the correct size */
1784 /* Scenario 8: A request for a heap block of less than PICO_MEM_MINIMUM_OBJECT_SIZE will have its size enlargened */
1813 uint32_t size = 50;
1830 block->internals.heap_block.size = size;
1832 byteptr += block->internals.heap_block.size;
1834 sizeLeft -= block->internals.heap_block.size;
1840 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
1855 block->internals.heap_block.size = size;
1857 byteptr += block->internals.heap_block.size;
1859 sizeLeft -= block->internals.heap_block.size;
1865 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));
1872 block->internals.heap_block.size = size;
1874 byteptr += block->internals.heap_block.size;
1876 sizeLeft -= block->internals.heap_block.size;
1882 block->internals.heap_block.size = (uint32_t)(sizeLeft - sizeof(struct pico_mem_block));