On Tue, 6 Jun 2006, Alexandre Leclerc wrote:
> 2006/6/6, Michael Van Canneyt <[EMAIL PROTECTED]>: > > > > > > On Tue, 6 Jun 2006, David Nicolás Abdala wrote: > > > > > > > >> Since the fpc list is down, I post my message here... > > >> > > >> > > >> ---------- Forwarded message ---------- > > >> From: Alexandre Leclerc <[EMAIL PROTECTED]> > > >> Date: 05.06.2006 17:27 > > >> Subject: Question about memory leaks with array of string > > >> To: FPC-Pascal users discussions <[email protected]> > > >> > > >> > > >> I made the following dynamic array: a: array of string. > > >> > > >> I do SetLength(a, 10) then assign values. In order to prevent memory > > >> leaks, does a simple SetLength(a, 0) will do the job, or do I have to > > >> also SetLength(a[n], 0) of all the values? > > > > This is not necessary. This is all handled automatically for you. > > Just do the setlength: > > SetLength(a, 10); > > > > The compiler does the rest. > > > > Michael. > > > > So if I do SetLength(a, 10) and push strings in that, then later do > SetLength(a, 3) and push string in that... there is no memory leak? > (Just to confirm.) Yes. No memory leak. Michael. _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
