Matriz mista, como liberar memória

Delphi

29/01/2007

Tenho a seginte matriz:
type
Tmatrizmista = Record
codigo: integer;
Ref: integer;
Produto: string;
quant: integer;
valor: Extended;

end;
Aí tenho um botão:
procedure TForm1.BitBtn3Click(Sender: TObject);
var
vetor:Array of Tmatrizmista;
i:integer;
begin
setlength(vetor,4);
vetor[0].quant:=1;
vetor[1].quant:=2;
vetor[2].quant:=3;
vetor[3].quant:=4;
for i:=0 to 3 do begin
showmessage(inttostr(vetor[i].quant));
end;

end;

Funciona beleza.
Quero liberar a memória para vetores em quande quantidade.
Alguem sabe?


Rinez

Rinez

Curtidas 0

Respostas

Rinez

Rinez

29/01/2007

Descupe o erro:
Em grande quantidade.
:lol:


GOSTEI 0
Massuda

Massuda

29/01/2007

Para liberar a memória usada pelo array of TMatrizMista, basta fazer...
var
  Vetor: array of TMatrizMista;
...
  // aloca memória
  SetLength(Vetor, 4);
  ...
  // libera todo o array
  Vetor := nil;
...



GOSTEI 0
Rinez

Rinez

29/01/2007

Massuda:
Muito obrigado pela sua resposta.
Prof. Zenir


GOSTEI 0
POSTAR