[fpc-pascal] replacement of MARK and RELEASE function in free pascal

Marco van de Voort marcov at stack.nl
Thu Jun 19 13:22:49 CEST 2014


In our previous episode, mokashe.ram said:
> Ok thanks,
> 
>    but using untyped pointer how to mention size in GETMEM()?
>    
> *      GETMEM(markexam,'' ....");*      

You misunderstood. You don't substitute getmem/freemem (or new/dispose) of
just the markexam pointer, but for ALL pointers allocated between mark and
release statements.

So basically you must delete the mark, release and markexam
declaration lines, and make sure that every allocated pointer is freed (-gh
can help with that).

Mark/release save/restore the stack top which allowed a release to release
all dynamically allocated memory since the last mark on that pointer. This
option (even the principle) is not available anymore in modern memory
managers.

Mark and release were already declared legacy in Turbo Pascal versions from
the early nineties.



More information about the fpc-pascal mailing list