> AllocTest1 > Reclaim 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:=+&3000 x= 26,12,20:x%=0:size%=32:step%=16:fix%=step%-4:claimed%=2 % Packs efficiently if fix=step-4 : Lbig%=m_alloc(size%):claimed%=size% : Claim an initial variable block 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);"% "; S 0,1: 69,x%,claimed%/16 :x%=&300:5,11:"claimed";4; P 0,3: 69,x%,(heapend%-heapbot%)/16 :x%=&320:5,11:"used";4; R 0,5: 69,x%,((heapend%-heapbot%)-claimed%)/16:x%=&340:5,11:"leaked";4; T 0,7: 69,x%,((heapend%-heapbot%)/claimed%)*40:x%=&360:5,11:"overhead";4;  : A Claim a fixed size block: | variable | fixed | : small%=m_alloc(fix%):small%:claimed%=claimed%+fix%  : A Release the previous variable block: | freed | fixed | "7 m_free(big%) :big%:claimed%=claimed%-size% , : 6R Claim a bigger block: | freed | fixed | bigger claimed | @ size%=size%+step% J8 big%=m_alloc(size%):big%:claimed%=claimed%+size% T : ^T This will result in: free32 fix12 free64 fix12 free96 fix12 free128 fix12... hN When the heap is full and no more big blocks can be claimed, the fixed r2 blogs will claim from all the free blocks: |] fix12 fix12 free8 fix12 fix12 fix12 free10 fix12 fix12 fix12 fix12 fix12...   Heap usage should be: ] Heap full, no more small blocks claimed D Heap full, no more big blocks claimed ______________ 6 ______________________________________/  / D / all free blocks used F / claiming remains of heap  / claiming big blocks  /  /  :  x%=x%+2 B '"small%=";~small%;" big%=";~big%;" size%=";~size%;" "  heap  x%>&800 size%<8:' & 0: :$heap:6"Addr"6"Size"6"Link" DA%=m_heap%: N#~A%;: A%:~!A%,~A%!4;:A%=A%!4 X: A%=0 >20:30: b: