periphery icon indicating copy to clipboard operation
periphery copied to clipboard

Periphery crashing due to High memory usage

Open mcstoufer opened this issue 5 months ago • 2 comments

Describe the bug A clear and concise description of what the bug is. Running this command takes about 2 hours to complete and results in it being killed by the system due to high memory usage: This died when process memory usage was 174GB and system swap was up to 62GB.

periphery scan --project Foo.xcodeproj --schemes FooPeriphery --skip-build --index-store-path $INDEX_ROOT --format xcode --exclude-tests --exclude-targets DesignComponentsDebugPanel
Image

I noticed that near the end we entered a zone of use that was spiking memory alerts: Image

Stack Trace sample: Sample of periphery.txt

Reproduction If you are reporting an incorrect result, please provide a sample Xcode or Swift package project that reproduces the issue.

  • Not sure how to repro this w/o recreating the entire complexity of the workspace structure.
  • Unable to determine if this was caused by long target dependency loops in our targets.

Environment Copy the output from running:

3.2.0
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) Target: arm64-apple-macosx15.0
Xcode 16.4 Build version 16F6

.periphery.yml

project: foo.xcodeproj
retain_objc_accessible: true
retain_public: true
schemes:
- Foo
- FooPlatform
- FooUI
- GlassUI

mcstoufer avatar Jul 24 '25 19:07 mcstoufer

+1 bump for any info. cc: @ileitch Thanks in advance.

DevFarid avatar Sep 30 '25 23:09 DevFarid

Are these projects very large? How many source files are being indexed?

ileitch avatar Oct 25 '25 10:10 ileitch

This appears to be fixed for us. There was a fix posted on your side that addressed the circular ref in the AST.

In fact, even with a project with about 30K files with ~45K classes/structs, it only took about 2-3 minutes to generate the report. The dump of the 60k issues took a lot more time.

mcstoufer avatar Dec 17 '25 22:12 mcstoufer

That's great to hear! I assume it was resolved by https://github.com/peripheryapp/periphery/commit/f97204e7c84d17733cc511f17057ea601c3ea099.

ileitch avatar Dec 18 '25 17:12 ileitch