Bug 410455 - Unable to parse Linux kernel sources
Summary: Unable to parse Linux kernel sources
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: 5.2.1
Platform: Ubuntu Linux
: NOR critical
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 475461 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-07-31 14:41 UTC by amit.geron
Modified: 2023-10-12 08:12 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amit.geron 2019-07-31 14:41:24 UTC
SUMMARY
Trying tp parse Linux kernel 5.2.1 sources, causes kdevelop process to consume all of the memory.

STEPS TO REPRODUCE
1. wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.1.tar.xz
2. tar xf linux-5.2.1.tar.xz
3. Open a new project in kdevelop from the extracted directory
4. Let the background parser begin parsing

OBSERVED RESULT
System get's stuck
Parser won't finish
Memory usage of kdevelop process keeps increasing

EXPECTED RESULT
Parsed project

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 18.04
(available in About System)
KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
KVM guest
4GB RAM
4 CPUs
Comment 1 Cyp 2023-08-30 13:10:35 UTC
Same here with kdevelop-23.04.3, memory usage reached 49 GB before the OOM-killer kicked in.

[1570147.196336] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
[1570147.197206] [  14374]  1000 14374 12368969  4650241 87040000  5140779             0 kdevelop
[1570147.197303] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=kdevelop,pid=14374,uid=1000
[1570147.197352] Out of memory: Killed process 14374 (kdevelop) total-vm:49475876kB, anon-rss:18600964kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:85000kB oom_score_adj:0
[1570154.066131] oom_reaper: reaped process 14374 (kdevelop), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Comment 2 Igor Kushnir 2023-08-30 15:17:10 UTC
(In reply to Cyp from comment #1)
> Same here with kdevelop-23.04.3, memory usage reached 49 GB before the
> OOM-killer kicked in.
Restarting KDevelop normally, rather than killing, when it consumes a lot of RAM, should let it keep parsing without loading all the previous parse results into RAM again. This way the parsing should finish after several restarts. That's assuming the huge RAM usage is a consequence of the project's large size, not some leak.
Comment 3 Sven Brauch 2023-08-30 15:36:41 UTC
While this should be fixed in KDevelop somehow, it's not necessarily easy to do so. 

For practical use, I'd recommend configuring a project filter to exclude the drivers/ and arch/ directories. Then, add another filter to specifically only include those things you want to work on. This has little practical effect for most usecases and trims down the project size to something manageable.

Alternatively (or additionally), another acceptable choice is to turn off "Schedule all project files for parsing" in the Settings under "Projects". Files and their includes will still be parsed when you open them, so navigation, highlighting, completion etc still work.
Comment 4 Cyp 2023-08-30 16:21:51 UTC
Restarting kdevelop without killing often isn't possible, since when quitting, it often ends up with 100% CPU forever in the background until killed.

Thanks, unchecking “Settings” (in the top menu bar) → “Configure KDevelop” → “Projects” → “Schedule all project files for parsing” seems to have helped.
Comment 5 Igor Kushnir 2023-10-12 08:12:11 UTC
*** Bug 475461 has been marked as a duplicate of this bug. ***