Instantly running out of available memory and freezing on project sync
Description of the bug:
All of a sudden with the new plugin (CLion version), I'm instantly running out of memory on a project where the plugin used to work for the past 3 years... There's no change to the project that I believe could have precipitated this... I'm seeing memory usage jump all of a sudden to >20 GB, I don't even have time to "produce memory report" before it freezes. Unfortunately, I cannot share the details of the project, as it is proprietary. I've already tried to completely recreate the project by copy/pasting the older .bazelproject, I'm experiencing the same exact effect after doing so.
Even after I stop the sync mid-way when I see memory go up, it doesn't seem to stop and completely clogs my memory.
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I can reproduce it by initiating a project sync or any partial sync.
Which Intellij IDE are you using? Please provide the specific version.
CLion 2025.2.4
What programming languages and tools are you using? Please provide specific versions.
C++, typescript, python
What Bazel plugin version are you using?
2025.11.03.0-api-version-252
Have you found anything relevant by searching the web?
Not so far.
Any other information, logs, or outputs that you want to share?
No response
Here's a CLion log file for just before the freeze... idea.log
I've established the reason for the extreme memory usage. The bazel project in question is wrapped inside a CMake project (to make it consumable by other CMake projects), so there were several build directories, such as cmake-build-release, in the project directory, which would contain the bazel cache as well as the cmake cache for an entire build. Even though the .bazelproject was configured as not to resolve targets automatically from all directories, simply because "." was included under directories:, it was trying to inspect the entire tree inside the cmake-build-release.
Previously, this was managable by excluding directories from within .clwb/.blaze/modules/.workspace.iml, by using the <excludeFolder url="..."> elements, but somehow this didn't work in this case, i.e. the file kept getting reset automatically by the plugin at runtime, erasing some of those build folder exclusions from .workspace.iml -- and these kept getting scanned during project Sync.
Removing the build directories recursively helped in this situation.
A reasonable remedy for this kind of situation is to re-introduce a formal folder exclusion mechanism via right-click context menu -> Mark Directory As -> Excluded, just like it currently works for CMake projects.
Hi, thanks a lot for the detailed report and the investigation. I'll check what we can do in this situation and get back to you.
Hey, sorry for the delay. I was just wondering if you started to see this issue after a plugin upgrade or a CLion upgrade?
Unfortunately, I can't really tell. I know that the issue keeps happening still, with most up-to-date stable versions of everything, i.e. edge/.clwb/.blaze/modules/.workspace.iml will occasionally get reverted as the IDE is running, and there's no formal exclusion mechanism through the IDE GUI.
The work-around seems to be to try and exit the IDE immediately after a edge/.clwb/.blaze/modules/.workspace.iml edit, then reload the project. In such cases, it seems to come back with the desired exclusions.
@Algomorph couple of questions
- would it be possible to share freeze reports from
.cache/JetBrains/CLion2025.2/log/threadDumps-freeze.*? - I see
Disabled plugins: C++ Language Support via ReSharper (252.27397.114), is there any reason for this, do you observe any issues with CLion Nova?
also reports and logs can be shared to uploads.jetbrains.com and we can have private access to them with 60 days autoremoval
@Algomorph couple of questions
- would it be possible to share freeze reports from
.cache/JetBrains/CLion2025.2/log/threadDumps-freeze.*?
Sorry -- I have nothing in the log remaining from way back on Nov 10 when I reported this. I haven't encountered the issue since I've cleaned out the folders and repeated the exclusions work-around.
- I see
Disabled plugins: C++ Language Support via ReSharper (252.27397.114), is there any reason for this, do you observe any issues with CLion Nova?
I haven't tried w/ CLion Nova, I don't see how it would have made a difference here. The reason I have Nova disabled is that there isn't full feature parity with the classic CLion engine yet (since last I checked) -- certain refactors are missing (e.g. class/struct constructors) -- which are important to my personal workflow.
But I digress -- the issue here was that specific directories, like cmake-build-release, had the bazel cache in there (we used custom --output_user_root bazel startup option back then, which allowed us to keep different-setting bazel builds localized to their own folders, just like CMake does, to avoid unnecessary rebuilds). These inadvertently would have gazillions of build files, and CLion would try to index them all, not knowing better. We have since done away with --output_user_root, as it was causing other issues, but the general problem with the Bazel plugin remains: there's no formal way to exclude a folder from the project explorer, like we have for CMake projects.
Thanks, got it. I'll share Nova feedback with the team working on it. Feel free to share freeze reports any time later if you observe any issues.
Indeed, exclusions management is a bit tricky thing in CLion that we're going to improve in 2026.1. Though as a workaround I guess 2 options are possible
- cmake build directory can be listed in project view file with
-prefix in directories section - from 2025.1.1 CLion creates gitignore file in cmake build directories, so the following VCS settings might help, but sure this won't help for build directories created manually.
cc @brm82
Thanks for your insights! I fully welcome better plugin support / GUI control via plugins.
Summary of Working & Suggested Solutions:
-
I think the edits to
edge/.clwb/.blaze/modules/.workspace.imland quick IDE restart work fine in 98% of cases, they have been my go-to solution. The only thing that changed (I'm not sure when exactly) was the Bazel plugin reverting the file somehow without my knowlede, which lead to me opening this issue in the first place. This solution, of course, isn't ideal - e.g., even ignoring the quest one has to undertake to ucover this "gem", I can't get it to ignore.claude(or, I think, any folder that precedes .clwb alphanumerically) no matter how much I try ;D -- at least with Bazel 6.5 (yes, we are still on 6.5, woe be us. Hopefully, not for much longer). -
I've actually tried modding the
.projectviewwith-back when the problem resurfaced, but I don't think that did the trick (again, keeping in mind Bazel 6.5 here, not sure if it would work with 7.4+ or not). -
I've also tried listing directories-to-exclude in
.bazelignore, but I don't know whether that actually worked or not. I suspect it works on some level for Bazel but doesn't prevent IDE from indexing the files irrespective of Bazel sync, like (2), but this needs confirmation. -
"Automatically exclude ignored directories from indexing" actually miraculously works -- or at least until I do have a valid case for separating the two, i.e. when I'd still want to index a folder I'm not git-ignoring or vice-versa. Moreover, it appears to respect the global gitignore (i.e. ~/.gitignore), so that works out perfectly fine for such IDE-specific folder patterns like
cmake-build-*/. @ujohnny , I highly appreciate this suggestion.
If you guys would prefer to close this issue at this point, it's perfectly fine by me -- I'd just make sure to open a task/issue here or up on YouTrack, wherever you keep track of such things, for the feature request to add folder exclusions via the project view for Bazel projects.