xcbeautify icon indicating copy to clipboard operation
xcbeautify copied to clipboard

Huge memory allocation with a big log file.

Open blastmann opened this issue 1 year ago • 2 comments

I try to debug xcbeatify with a 250MB xcode build log file.

After running a moment, memory allocation is up to 1.1GB above. I think that is not a proper memory consumption.

image

So I dig into the memory allocation of this situation, there is a while-loop in Xcbeatify.swift without autoreleasepool.

Maybe we should consider to add a proper autoreleasepool in order to keep a low memory level like this:

image

blastmann avatar Feb 26 '24 12:02 blastmann

Hi @blastmann! I released two new versions of xcbeautify yesterday.

  • 1.5.0 should resolve your problem (also reported by #162). You can see the performance tests here.
  • 1.6.0 introduces SwiftCompile support. You should see more accurate logs, since we're capturing the output; the logs should also be much faster, since we're no longer looping through each regex. You can see the performance tests here.

I tried your suggestion, using autoreleasepool, with the latest release, but I'm not seeing any significant differences in memory consumption.

This is not to say there aren't additional areas for improvement, but I think you'll notice notable improvements with the recently released versions. Let me know!

cpisciotta avatar Feb 26 '24 14:02 cpisciotta

Hi @cpisciotta. So glad to see there is a huge performance improvement.

I test the memory consumption with the newest code and it doesn't easy to reproduce this issue any more.

Using autoreleasepool in loop is some kinds of best practise of performance optimization and release memory ASAP.

Maybe we should consider using it in this situation. :)

blastmann avatar Feb 27 '24 02:02 blastmann