Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling free on objects created and returned by a .net method
#1
Hi,

I understand that if I create a .net object from Delphi then CrossTalk on the .net side will keep a reference to it until I call free to avoid it being collected by the Garbage Collector.

What happens if the .net object is created and returned by a .net method? Will CrossTalk keep a reference to it until I call free? If so does that means that whenever an object is returned I must call free on it on the Delphi side?

Regards
Geza
Reply
#2
I have tested this. CrossTalk will keep a reference to it until free is called.

If free is not called then the Delphi Stub is never freed and the .Net object is never garbage collected.
Reply
#3
Correct. CT objects are to be treated like normal Delphi objects. You must free them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)