MobileNativeFoundation / XCLogParser

Tool to parse Xcode and xcodebuild logs stored in the xcactivitylog format
Apache License 2.0
1.75k stars 125 forks source link

Memory not released after ActivityParser.parseActivityLogInURL call #215

Open jrcmramos-bumble opened 1 month ago

jrcmramos-bumble commented 1 month ago

Hi, I would like to report an issue happening on 0.2.39.

The ActivityParser.parseActivityLogInURL call seems to leak a considerable amount of system memory indefinitely. Tried to workaround the problem using previous versions of the framework, but they all seem to have the same problem (tested up to 0.2.34). (Maybe problem due to recent version of Xcode toolchain?). While trying to break down internal calls, the problem seemed to be located on the Lexer.tokenize call.

I created this playground project where we simply try to decode some .xcactivitylog located under a certain path. Even using the autorelease pool, the program is not able to release the memory efficiently after parsing each log. At the end, all logs are parsed and a huge amount of memory is still in use (around 500MB for 6.6 MB of log files). While looking at the object graph, the objects leaked are of type CFString and CFString(Storage).

Steps to reproduce:

Context: MacOS: Sonoma 14.6.1 Device: MacbookPro M1 Xcode: 15.4.0 XCLogParser installation: 0.2.39 (SPM)