Re: Array of PChar (about freeing memory)

2006-06-08 Thread Alexandre Leclerc
2006/6/8, Marc Weustink <[EMAIL PROTECTED]>: I think, this is not really a memory leak, but more likely memory fragmentation, since you are allocating random lengths. However I don't know if SetLength reduces the mem when the length of an array is shortened. It might be that you are working with

Re: Array of PChar (about freeing memory)

2006-06-08 Thread Marc Weustink
Alexandre Leclerc wrote: 2006/6/7, Alexandre Leclerc <[EMAIL PROTECTED]>: I asked the question for a string array. I see that we can assign a string directly to a pchar, but when I SetLength() such an array, do I have to free the PChar string no more used or is it done automatically? var a:

RE: Array of PChar (about freeing memory)

2006-06-07 Thread George Birbilis
At Delphi, the runtime memory manager is supposed to handle the strings. Any PChars are just pointers to those strings I think. When you use a Pchar as a string, it must be getting some runtime string proxy that keeps that pchar and has some size calculation function instead of pointing to some cla

Re: Array of PChar (about freeing memory)

2006-06-07 Thread Alexandre Leclerc
2006/6/7, Alexandre Leclerc <[EMAIL PROTECTED]>: I asked the question for a string array. I see that we can assign a string directly to a pchar, but when I SetLength() such an array, do I have to free the PChar string no more used or is it done automatically? var a: array of PChar; begin Set

[lazarus] Array of PChar (about freeing memory)

2006-06-07 Thread Alexandre Leclerc
I asked the question for a string array. I see that we can assign a string directly to a pchar, but when I SetLength() such an array, do I have to free the PChar string no more used or is it done automatically? var a: array of PChar; begin SetLength(a, 4); a[0] := 'First pchar line'; a[1] :=