Quote:
Originally Posted by DMWCashy
AllocVec will allocate an extra memory block chunk (I believe this is 8 bytes) for the memory details followed by the required memory. This makes it easy for FreeVec() to verify the block, by simply moving back one block ( Same as modern PC based memory heaps work)
|
If I remember correctly, the code for AllocVec is something like this:
Code:
addq.l #4,d0
move.l d0,-(sp)
jsr _LVOAllocMem(a6)
tst.l d0
beq.s NoMem
move.l d0,a0
move.l (sp)+,(a0)+
move.l a0,d0
rts
NoMem: addq.l #4,sp
rts