I tried to return from dll function my own object (derived from TCollection). I used FastMemoryManager, but without success... So I tried to return dynamic array of some objects.
Length of the array of set of course in dll function.
It works realtive good, but allocated memory is not freed.
(I measure with Windows tarsk manager). Is there some possibility how to release the dynamic array?
The procedure which call the dll function is in the thread, and in the end I have follows:
for i := 0 to length(MyObjectArray) - 1 do begin
if MyObjectArray[i] <> nil then
MyObjectArray[i].Free;
end;
Setlength(MyObjectArray, 0);
MyObjectArray := nil;
If I used instead of Setlength(MyObjectArray, 0) and MyObjectArray := nil,
FreeAndNil(MyObjectArray) exception was raised.
Any suggestion?