On 18 Dec 2011, at 14:04, dhkblas...@zeelandnet.nl wrote:

> mytest^.name := Format('%s.%.3d', ['name', 1]); 
> 
> This assigns
> 'name.001' to the pointer variable but causes a memleak. If I assign the
> same value as string constant no memleak occurs, so it must be something
> related to format. 

It's related to
a) the type of "name" (I assume it's an ansistring or unicodestring)
b) how you free the memory to which mytest points

If you use freemem or reallocmem, then you will get a memory leak because 
freemem/reallocmem do not finalize the memory before freeing it. You have to 
manually call finalize() on the records inside that memory block prior to 
freeing them via freemem/reallocmem. dispose on the other hand will finalize 
the freed memory automatically.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to