Hello, I don't have much history with Delphi.
Hello, I don't have much history with Delphi. I like FireMonkey and program in C++ Builder, but recently I've tried Delphi since RAD Studio seems to work much better with Delphi.
My questions are:
1) How do you know when to call 'Free' on an object? I know you should whenever you call 'Create', but what about when other methods allocate memory for you and pass you the new reference? Is this just like in C++ when you can't be sure the function you are calling allocates memory unless it's documented? Is there a convention for naming methods that allocate memory?
2) If I'm targeting a platform that has ARC in Delphi, what do I do about 'Create' and 'Free' then? Does anything change from a Delphi developer's point of view?
Thanks in advance!
My questions are:
1) How do you know when to call 'Free' on an object? I know you should whenever you call 'Create', but what about when other methods allocate memory for you and pass you the new reference? Is this just like in C++ when you can't be sure the function you are calling allocates memory unless it's documented? Is there a convention for naming methods that allocate memory?
2) If I'm targeting a platform that has ARC in Delphi, what do I do about 'Create' and 'Free' then? Does anything change from a Delphi developer's point of view?
Thanks in advance!
Comments
Post a Comment