Hello, I have a question.
It is correct this implementation for a complex type named tcliente
I am doing some testing with complex types, and I want to understand it all before doing it in production.
I have this type:
tcliente = class(TROComplexType)
private
fnombre: string;
fapellido: String;
fsueldo: double;
published
property nombre :string read fnombre write fnombre;
property apellido : String read fapellido write fapellido;
property sueldo: double read fsueldo write fsueldo;
end;
and this is the implementation for one test function.
[ROServiceMethod]
function saludacliente(cliente:string):tcliente;
function TTestService.saludacliente(cliente: string): tcliente;
var resp:tcliente;
begin
resp:=tcliente.Create;
resp.nombre:='Hola '+cliente+' nombre';
resp.apellido:='Adios '+cliente+' apellido';
resp.sueldo:=5000;
Result:=resp;
//resp.Free;
end;
If i tried resp.free i got exceptions when calling the function; if not, it runs correctly.
Is it okay not to do resp.free?
There is going to be a memory leak in the server if you don’t do it?
If I have to do it, what is the proper way?
As always, thanks for your advice.