[fpc-devel] GetMem(SomePointer, 0) <> nil

Paul Ishenin webpirat at mail.ru
Wed Mar 2 01:35:48 CET 2011


02.03.2011 5:24, Jonas Maebe wrote:
> To a small, non-zero sized memory block.

Memory allocation is time cost. Either user code should compare that for 
the zero bytes it should not call a GetMem or GetMem can compare this 
for user. Since GetMem already has a condition which compares for 0 - it 
is be the best place for doing this.

Therefore FPC GetMem is not only incompatible with delphi GetMem but 
also can slowdown an application if it relies on GetMem logic and does 
not have a special checks for Count = 0 case.

Best regards,
Paul Ishenin



More information about the fpc-devel mailing list