[fpc-devel] an observation about GetMem

petr.kristan at epos.cz petr.kristan at epos.cz
Mon Sep 8 09:47:05 CEST 2008


On Sat, Sep 06, 2008 at 11:25:19AM +0100, Jonas Maebe wrote:
> 
> On 05 Sep 2008, at 17:25, Peter Popov wrote:
> 
> >>In FPC it is done by design. If 0 bytes are asked we allocate at  
> >>least the minimum alignment to
> >>get a valid pointer. This is done for compatibility with TP7.0 that  
> >>returns the value of heapptr
> >>which is also a valid pointer.
> >
> >Thanks for the clarification!
> >I guess if you switch to reallocmem entirely, there will be delphi  
> >compatibility, yes?
> 
> reallocmem indeed frees the memory and sets the pointer to nil if you  
> specify "0" as the memory size.

Look at thread "AllocMem(0)<>nil" at 25.03.08. I had the same problem.

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709



More information about the fpc-devel mailing list