> 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.
AllocMem uses internally the same memory allocation as GetMem. So the behaviour of FPC is by design. Peter _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
