This will give an access violation, because you didn't allocate memory for the array.
Revised example (untested)
var arr : array of integer;
begin
SetLength(array, 2); // don't forget this.
arr[0] := 1;
arr[1] := 4;
end;
You don't need to free the array after using it, the compiler generates code for that.