[fpc-devel] compile time memory leak detection

Nikolai Zhubr zhubr at mail.ru
Tue Jan 19 20:10:49 CET 2010

19.01.2010 17:49, JoshyFun пишет:
> var
>    p: pchar;
> begin
>    GetMem(p,10);
>    inc(p,random(30));

Yes, this is among things which should probably be immediately 
disallowed at compile-time (as long as one wants reasonably safe 
pointers) because they are hard (or expensive) to validate later.

I usually try to not use raw pointer arithmetics and either use 
new/dispose with typed pointers or constructs like GetMem(X, 
SizeOf(X^)). However, compiler does not force me to do so.


More information about the fpc-devel mailing list