当一个对象在函数内被创建并且函数执行完成后,如果没有显式地销毁该对象,它会发生什么?
所有变量都需要在其作用域结束时被销毁吗?还是它们在作用域结束时会被自动处理?
例如,custom_function 被调用后,locallist 会发生什么?
function TForm1.custom_function(string: test_string): boolean;
var locallist: TStringList;
begin
locallist := TStringList.Create;
// do a bunch of stuff here, but don't destroy locallist
return true;
end;