bazelbuild / bazelbuild/bazel

Ability to override RAM estimate for cppcompile action

Open
#25,770 7 comments 0 reactions 0 assignees View on GitHub
P3 team-Performance team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

Currently our bazel build crashes on most machines due to an inaccurate RAM estimation: our .cpp compiles take 2-4 GB of RAM so will crash on machines where the available RAM/CPU count is less than that.

Currently there doesn't seem to be a way to override the estimate:

```
return ResourceSet.createWithRamCpu(/* memoryMb= */ 80 + 0.7 * inputs, /* cpu= */ 1);
```

for this action, though `resource_set` is available to do this for some other actions. It is also not clear what "inputs" is in the context of cppcompile actions (this probably makes more sense for links).

### Which category does this issue belong to?

_No response_

### What underlying problem are you trying to solve with this feature?

No crashing on parallel builds where each compile job uses a lot of RAM.

### Which operating system are you running Bazel on?

Linux

### What is the output of `bazel info release`?

release 7.5.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

n/a

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

For which repo?

### Have you found anything relevant by searching the web?

Yes. It seems like this functionality is not available currently for native jobs, though things like `resources:memory` tag can work for some other jobs.

### Any other information, logs, or outputs that you want to share?

Not at this time.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the cppcompile action's ResourceSet.createWithRamCpu call and compare it with actions where resource_set or resources:memory already works. Define how a user-supplied RAM estimate reaches native compile actions, then verify that parallel builds honor the override without the current memory-related crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.