array with same value all the time?



Hi!

I have a project where I collect data into this:

TDataRec = record
Name: string[81];
RecordTime: TDateTime;
Value: double;
end;

I have an array ot that; where I add data when I get it (it happens in
a thread) - there is a TCristicalSection to avoid multiple instances
using it.
There is a procedure in the thread, which adds data.

The execute part looks at data, when there is enough, it goes in,
processes data, and delete them (that means - moving them, and setting
the array that much shorter using SetLenght) - usually it is cleared to
0 size.

{ delete used data }
i := iUsedData;
while i < Length(aData) do
begin
aData[i-iUsedData] := aData[i];
Inc(i);
end;
SetLength(aData, Length(aData) - iUsedData);

My problem is that sometimes for some reason, the Value is the same for
all records - that is possible, that it might happen once in a million
years, but not once a day as I get it. The name is the same, but the
timestamp is chaning correctly. It is just the recieved value, which
repeats itself.

BR
Sonnich

.