Hello, dear experts. Actually the question:
What is the best way to allocate memory for a dynamic array β SetLength or AllocMem ? For example:
type TMyArray = array of Integer; var MyArray: TMyArray; PMyArray: ^TMyarray; begin //ΠΠ°ΡΠΈΠ°Π½Ρ Ρ SetLength SetLength(MyArray,High(Word)); .....ΠΊΠ°ΠΊΠΈΠ΅-Π½ΠΈΠ±ΡΠ΄Ρ Π΄Π΅ΠΉΡΡΠ²ΠΈΡ..... //ΠΠ°ΡΠΈΠ°Π½Ρ Ρ AllocMem try PMyArray := AllocMem(High(Word)*SizeOf(Word)); ................. ΠΊΠ°ΠΊΠΈΠ΅-Π½ΠΈΠ±ΡΠ΄Ρ Π΄Π΅ΠΉΡΡΠ²ΠΈΡ ................. finaly FreeMem(PMyArray,High(Word)*SizeOf(Word)); end; Or no difference?