6

I am having a lot of trouble with stupid SourceKitService. It is taking up like 20GB of memory sometimes and just means my lapTop is pretty much useless it is so slow. I am using xCode 6.4 and working in Swift. I am working on a large project so I am sure that contributes to the problem.

But I was just wondering if anyone has found away to tame the SourceKit beast and stop it from going out of control and taking all my memory?

villy393
  • 2,985
  • 20
  • 28
  • UPDATE: Just caught SourceKitServe consuming 30GB of memory. – villy393 Jul 21 '15 at 10:04
  • Not a programming question. Sample Xcode, run sysdiagnose (Shift-Control-Option-Command-Period) and report it to the Apple via [radar](http://bugreport.apple.com). That's all you can do. Otherwise you'll get opinion based answers, tips, without real knowledge / solution. – zrzka Jul 21 '15 at 10:09
  • 2
    Thanks for the advice. Where would be the best place to get 'opinion based answers & tips'. Thats kind of what I am after. Will take whatever I can get. – villy393 Jul 21 '15 at 10:15
  • I would search & ask at [Apple Developer Forums](https://devforums.apple.com) for these kind of questions. You'll have better chance that someone from Apple can read & answer it as well. But I'm afraid you'll just end up with the same answer - sample, sysdiagnose, report, ... Who knows, worth to try. – zrzka Jul 21 '15 at 10:23
  • 4
    You're not [alone](https://devforums.apple.com/message/1064700#1064700). – zrzka Jul 21 '15 at 10:29
  • Does anyone have any ideas on this one? Still experiencing this issue and have nothing to go on. Cheers – Henry Heleine Jan 12 '16 at 02:04

1 Answers1

2

I encountered this issue in XCode 7 and it was still present after upgrading to XCode 8. In my case I narrowed it down to a bit of code that calls a database wrapper (GRDB) like so:

db.execute(sqlStatement,arguments:["ParamNameA":someValueA,"ParamNameB":someValueB]);

If the number of elements in the arguments dictionary is more than 20, SourceKitService memory usage goes nuts (15 GB or more) and the compile times are over 10 minutes. If the number of elements is less than or equal to 20, memory usage of SourceKitService is under 200 MB and compile time is a couple of seconds.

I would suggest looking for bits of code that have a dictionary of more than 20 elements and commenting them out to see if the problem goes away.

Eiko
  • 25,601
  • 15
  • 56
  • 71
David Wood
  • 29
  • 3