EXC_BAD_ACCESS on large trees in SwiftSyntax

I'm getting Thread 19: EXC_BAD_ACCESS (code=2, address=0x70000ebf1f90) when traversing a large Syntax tree with the SyntaxVisitor in Swift Syntax. Anyone else get this? I don't know how we should or can address this...maybe it's something simple on my end.

There is a bug that caused SwiftSyntax to eat a massive amount of memory in debug mode, causing a stack overflow, especially when running on non-main thread which has smaller stack. [SR-12360] SwiftFormat uses a SwiftSyntax tag that can cause stack overflow in debug mode · Issue #334 · apple/swift-format · GitHub

It looked very similar to what you're experiencing now.

Are you using a recentlish version of SwiftSyntax? If not, try to update because there is a workaround written by ahoppen merged in february.

I'm using the tag for Swift 5.3.

I also had this stack overflow issue for my personal library which makes SwiftSyntax trees transmittable over JSON. I had a solution which avoided this stack overflow. Maybe similar fix could be make for the Syntax Vistor?

My repo here. https://github.com/joehinkle11/SwiftSyntaxStubs