@asptrader
There are two ways to free memory for result array:
1. If the dll is not yours, check all its exported functions. There must be a function to release memory.
If the dll is yours, then you can add such function yourself.
2. If the dll is yours, you can change MyFunc function to receive result array from Delphi.