> AllocTest2 < Claim increasing blocks interspersed with fixed blocks : ( test%=3 2: < test%=1:ț "MallocA/sr" F test%=2:ț "MallocB/sr" P test%=3:ț "MallocC/sr" Z- test%=0: >&FFFF:ț @lib$+"MAlloc.bbc" d4 test%=0: <&FFFF:ț "%.^.Library.BLib.MAlloc" n >&FFFF:=+&4000 x. 26,12,20:x%=0:size%=0:step%=1:claimed%=2 : Hsmall%=0:heapend%=0: heapbot% -1 : Ensure all variables defined   heapend% -1 30;"Claimed: ";claimed%;" Used: ";heapend%-heapbot%;" Leaked: ";(heapend%-heapbot%)-claimed%;:claimed%:" Overhead: ";(100*((heapend%-heapbot%)/claimed%)-100);"% "; T 0,1: 69,x%,claimed%/16 :x%=&300: 5,11:"claimed";4; Q 0,3: 69,x%,(heapend%-heapbot%)/16 :x%=&320: 5,11:"used";4; S 0,5: 69,x%,((heapend%-heapbot%)-claimed%)/16:x%=&340: 5,11:"leaked";4; U 0,7: 69,x%,((heapend%-heapbot%)/claimed%)*40:x%=&360: 5,11:"overhead";4;  : 6 Claim a fixed size block: | fixed | 7 small%=m_alloc(12) :small%:claimed%=claimed%+12  : G Claim a bigger block: | fixed | bigger claimed |  size%=size%+step% 8 big%=m_alloc(size%):big%:claimed%=claimed%+size% " : ,M This will result in: fix12 big32 fix12 big64 fix12 big64 fix12 big128 6 Until the heap is full @ J Heap usage should be: T ^ h2 Heap full, no more big blocks claimed rF | ______________________________________________________ | _/ 3 / Last couple of small blocks claimed  / * / claiming small and big blocks  /  /  :  x%=x%+2 C '"small%=";~small%;" big%=";~big%;" size%=";~size%;" "  heap  x%>&800 size%<1:'  : $heap:6"Addr"6"Size"6"Link" A%=m_heap%: #~A%;: A%:~!A%,~A%!4;:A%=A%!4 : A%=0 >20:30: &: