Potential memory leaks reported by Xcode Instruments when using XData on iOS

Hello,

We are investigating customer reports regarding increased memory usage, overheating, and battery consumption on iOS devices.

To better understand the behavior, we profiled our application using Xcode Instruments and compared XData requests with Delphi's standard REST components.

Environment

  • Delphi 13.1

  • iOS

  • XData Client

  • Xcode Instruments (Allocations / Leaks)

Test Setup

  • Same iOS device

  • Same application build

  • Same endpoint

  • Same response payload

  • 500 consecutive requests executed

  • Memory monitored using Xcode Instruments

Results

XData

Allocations: 1,225,990
Leaks Count: 3,859
Leaks Size: 361.78 KiB

REST Components

Allocations: 2,287,832
Leaks Count: ~1,200
Leaks Size: ~120 KiB

Observations

  • REST components generate significantly more allocations than XData.

  • However, Xcode Instruments reports substantially more leaks when using XData.

  • The reported leak size for XData is approximately three times larger than the leak size reported for REST components.

  • Since both implementations call the same endpoint and process the same data, we are trying to understand whether the reported leaks are expected or indicate a problem in XData.

Questions

  • Are there any known memory leak issues in XData on iOS?

  • Has XData been validated recently against the latest iOS SDKs and Delphi 13.1?

  • Are the reported leaks expected allocations retained by XData internally, or should they eventually be released?

  • Is there any recommended cleanup procedure for XData client objects after repeated requests?

We can provide Instruments traces, screenshots, and a sample project if required.

Thank you.

Not yet.

We didn't make any specific tests for Delphi 13.1 and latest iOS SDKs.

I don't know, we would need to see the reported leaks. But I find it strange that both Delphi REST components and XData leaks. Maybe those are just regular leaks that Instruments "thinks" are issues? Are you sure the problem in HTTP requests?

That would be just releasing the client components.

I believe the reports would be useful, especially the claimed leaks and the respective source code/call stack of the moment of leak generation.

Here is demo project

i also asked to Embarcadero within customer portal for REST component they responded like this if its helps.

I have reproduced the problem after modifying the test case to call a dummy RAD Server package.

I have logged bug, RS-132216 for the issue. This is in our internal system so you cannot track it directly. I will keep the case open with a status of Deferred Development until the issue is resolved.