[fpc-pascal] string memory management

Xiangrong Fang xrfang at gmail.com
Fri Apr 19 09:38:02 CEST 2013


2013/4/19 Michael Van Canneyt <michael at freepascal.org>

>
> 1. I don't know whether I have to MANUALLY free memory for these strings to
>
>> prevent leak?
>>>
>>
> Yes, if you work like this, you must do all that. You must free all
> pointers in the list, and the strings they point to.
>
> But why not use TStringList ? It does all this for you.


Because I want to then concat the strings into a big string using CRLF, but
the TStringList.Text method concat them using LF only. I think that might
be platform dependant, which is not what I want.

Now I use a TStringStream for this purpose.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130419/a5ccb293/attachment.html>


More information about the fpc-pascal mailing list