Removing an array of objects in Free Pascal

I would like to create a two-dimensional array of objects TMyClass, considering that each of these objects contains an array of references to TMyClass, i.e.

type
    TMyClass = class
        MyArray: array[0..10] of TMyClass;
        constructor Create;
        destructor Destroy;
    end;

    TMyMatrix = array of array of TMyClass;

var
    matrix: TMyMatrix;

begin
    SetLength(matrix, 10, 10);
    (...) { matrix[i, j].Create; ? }

1) Will the array of links ( MyArray) be automatically deleted (without affecting the actual objects) when the object is deleted, TMyClassor should I take care of this manually?

2) How about deleting a dynamic array of objects ( matrix)? The Free Pascal wiki says that assigning to a nildynamic array frees up the memory pointed to by the pointer, but I assume that it will not name any destructors.

+3
source share
1 answer

1) , TMyClass, MyArray , . , , . ( ).

2) , , null , , . , 2D- .

" nil , ". , , , , ( ).

Ref. http://wiki.freepascal.org/DYNAMIC_ARRAY

+3

All Articles