[fpc-devel] Array of Ansistring
Florian Klaempfl
florian at freepascal.org
Mon Mar 12 16:31:19 CET 2007
Flávio Etrusco schrieb:
> A slightly related question: does FPC memory manager release unused
> memory back to the OS?
Yes, but it keeps always one block to avoid repeated allocating/releasing.
>
> Regards,
> Flávio
>
> On 3/12/07, Bram Kuijvenhoven <kuifwaremailinglists at xs4all.nl> wrote:
>> Jason P Sage wrote:
>> > MyArray: Array of ansistring;
>> >
>> > There is code I saw that seems to work great using:
>> >
>> > SetLength(MyArray,100);
>> >
>> > Which allows MyArray[100]:='Some ansiString';
>>
>> Dynamic arrays start at index 0 up to Length-1, so actually this code
>> would corrupt memory ;) (but I assume this is a typo in your mail)
>>
>> > What I don't know is how to clean this up.
>>
>> It is cleaned automatically when the array goes out of scope (taking
>> into account the refcounting of the dyn array itself), but of course
>> also when you explicitly set the strings to '' or the array length to
>> 0, as you proposed already. As Marco says, memory is usually not
>> directly released back to the OS. BTW, memleaks can also be checked
>> for with the heaptrc unit.
>>
>> Regards,
>>
>> Bram
>>
>>
>> _______________________________________________
>> fpc-devel maillist - fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
More information about the fpc-devel
mailing list