Working with string splitting functions and memory allocation lazarus / 61-Beginners ---------------------------------------------------------------------- Galmer · 2024-04-07 11:45 Hello World! Please tell me, when working with functions such as SplitString(str, delimeters) and string.Split(delimeters), arrays of strings are returned. After working with these arrays, do you need to somehow free up the memory allocated for them? I'm still not very good with memory management in FreePascal, especially after C languages ---------------------------------------------------------------------- marcov · 2024-04-07 11:46 splitstring returns a dynamic array which are automatically managed. ---------------------------------------------------------------------- Galmer · 2024-04-07 11:53 Quote from: marcov on April 07, 2024, 01:46:50 pmThanks I got it! Apparently there is a link counting going on there. What about the string.Split(delimeters) method? The type returned there is TStringArray. Is it also controlled by the memory manager? ---------------------------------------------------------------------- runewalsh · 2024-04-07 12:01 Use heaptrc unit (-gh compiler option), it will report you leaks. If something leaks, you didn’t free it properly, if nothing leaks, your memory management was correct. ---------------------------------------------------------------------- Thaddy · 2024-04-07 12:25 The latter is never the case with string.split and family. If it was it is a bug. ---------------------------------------------------------------------- Leledumbo · 2024-04-09 20:20 Quote from: Galmer on April 07, 2024, 01:53:23 pmWhat about the string.Split(delimeters) method? The type returned there is TStringArray. Is it also controlled by the memory manager? Just see what TStringArray used is defined as: https://www.freepascal.org/docs-html/rtl/sysutils/tstringarray.html.