XData return an List without freeing it

Hi @Ansgar_Gosling, welcome to TMS Support Center!

It's partially possible (see below)

This is a very peculiar situation, actually, because usually you should not use global/singleton data in the services, because they are multithreaded.

Thus, it will only work and make sense in the specific case where you have global data that is never modified. It might be your case, but then I would just suggest that you create a local copy of the data from the global one and return it.

What you can do to help in this task is to tell XData to destroy only the root object (the list, for example) and not the "inner" objects (the itens in list, for example).

You do that this way:

TXDataOperationContext.Current.Handler.ActionResultDestruction := TActionResultDestruction.RootOnly;

Reference: