Re: [yocto] Limiting Yocto Memory Usage

Randy MacLeod <[email protected]> Tue, 14 Jul 2026 17:33:04 -0400
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
--------------zXbtEdKpYmWZuypEyXgR6OnQ
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 66EIxmLp2631659

Hi Luis,

On 2026-07-10 17:26, Luis Merayo via lists.yoctoproject.org wrote:
> Hi,
>
> I would like to know if there is a way to limit Bitbake's Memory usage=20
> to a specific percentage of the available RAM. For example, can the=20
> Yocto build be limited to use a maximum of 70% of RAM?
Not without using a container to do the build.
>
> Could these three variables achieve this?
>
> BB_PRESSURE_MAX_CPU=20
> <https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PR=
ESSURE_MAX_CPU>,=20
> BB_PRESSURE_MAX_IO=20
> <https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PR=
ESSURE_MAX_IO>=C2=A0,=20
> BB_PRESSURE_MAX_MEMORY=20
> <https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PR=
ESSURE_MAX_MEMORY>
>
> I see the range for these variables is from 1 to 1000000, so I would=20
> like to understand if there is a way to specify their values as a=20
> function of the available=C2=A0RAM.
No, there is only pressure when resources are over-commited so if you=20
have free memory, there's no over-commit.
https://docs.kernel.org/accounting/psi.html

That's the design intent of the bitbake PRESSURE regulation system.

There are plans to work on additional build system regulation.

The first idea is to use the jobserver design:
https://lore.kernel.org/openembedded-core/?q=3DGNU+AND+jobserver++AND+f%3=
Amacleod
and that would indirectly limit memory consumption since there would be=20
fewer instances of gcc / rustc / ... running
at once.

There's also an even less clear idea about being able to restrict the=20
build by specifying memory usage.
That shouldn't be too hard to implement in bitbake in the same point=20
where the pressure checks happen.
Are you interested in working on that ?

There are of course other levers to pull to reduce CPU/memory consumption=
:
https://docs.yoctoproject.org/dev-manual/limiting-resources.html

Have you tried them ?


>
> Regards,
>
> Luis
>
>
>
> File:RidgeRun.ai banner.png <https://ridgerun.ai/>
> This email and any attachments are intended for the sole use of the=20
> named recipient(s) and contain(s) confidential information that may be=20
> proprietary, privileged, or copyrighted under applicable law. If you=20
> are not the intended recipient, do not read, copy, or forward this=20
> email message or any attachments, delete this email message and any=20
> attachments immediately.
>
> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
> Links: You receive all messages sent to this group.
> View/Reply Online (#66637):https://lists.yoctoproject.org/g/yocto/messa=
ge/66637
> Mute This Topic:https://lists.yoctoproject.org/mt/120213825/3616765
> Group Owner:[email protected]
> Unsubscribe:https://lists.yoctoproject.org/g/yocto/unsub [randy.macleod=
@windriver.com]
> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
>

--=20
# Randy MacLeod
# Wind River Linux

--------------zXbtEdKpYmWZuypEyXgR6OnQ
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <head>

    
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Luis,<br>
      <br>
    </div>
    <div class="moz-cite-prefix">On 2026-07-10 17:26, Luis Merayo via
      lists.yoctoproject.org wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAPGGCfrQqFjk68=6_JXCrj3XyxK1inZUNzjx4JZikm0MfhfQFg@mail.gmail.com">
      
      <div dir="ltr">
        <div><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px">Hi,<br style="box-sizing:border-box">
            <br style="box-sizing:border-box">
            I would like to know if there is a way to limit Bitbake's
            Memory usage to a specific percentage of the available RAM.
            For example, can the Yocto build be limited to use a maximum
            of 70% of RAM?<br style="box-sizing:border-box">
          </font></div>
      </div>
    </blockquote>
    <font face="Work Sans, sans-serif" color="#232e3c">Not without using
      a container to do the build.</font>
    <blockquote type="cite" cite="mid:CAPGGCfrQqFjk68=6_JXCrj3XyxK1inZUNzjx4JZikm0MfhfQFg@mail.gmail.com">
      <div dir="ltr">
        <div><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px"><br style="box-sizing:border-box">
            Could these three variables achieve this?<br style="box-sizing:border-box">
            <br style="box-sizing:border-box">
          </font><span style="box-sizing:border-box;color:rgb(51,51,51);font-size:16px;font-family:Verdana,sans-serif;background-color:rgb(252,252,252)">&nbsp;</span><a class="gmail-reference gmail-internal" href="https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PRESSURE_MAX_CPU" rel="nofollow noopener" target="_blank" style="box-sizing:border-box;color:rgb(68,68,68);text-decoration:none;font-size:16px;font-family:Verdana,sans-serif" moz-do-not-send="true"><span class="gmail-xref gmail-std gmail-std-term" style="box-sizing:border-box">BB_PRESSURE_MAX_CPU</span></a><span style="color:rgb(51,51,51);font-family:system-ui,&quot;Segoe UI&quot;,Roboto,&quot;Helvetica Neue&quot;,&quot;Noto Sans&quot;,&quot;Liberation Sans&quot;,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,&quot;Segoe UI Symbol&quot;,&quot;Noto Color Emoji&quot;;font-size:16px">,&nbsp;</span><a class="gmail-reference gmail-internal" href="https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PRESSURE_MAX_IO" rel="nofollow noopener" target="_blank" style="box-sizing:border-box;color:rgb(68,68,68);text-decoration:none;font-size:16px;font-family:Verdana,sans-serif" moz-do-not-send="true"><span class="gmail-xref gmail-std gmail-std-term" style="box-sizing:border-box">BB_PRESSURE_MAX_IO</span></a><span style="color:rgb(51,51,51);font-family:system-ui,&quot;Segoe UI&quot;,Roboto,&quot;Helvetica Neue&quot;,&quot;Noto Sans&quot;,&quot;Liberation Sans&quot;,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,&quot;Segoe UI Symbol&quot;,&quot;Noto Color Emoji&quot;;font-size:16px">&nbsp;,&nbsp;</span><a class="gmail-reference gmail-internal" href="https://docs.yoctoproject.org/dev/ref-manual/variables.html#term-BB_PRESSURE_MAX_MEMORY" rel="nofollow noopener" target="_blank" style="box-sizing:border-box;color:rgb(68,68,68);text-decoration:none;font-size:16px;font-family:Verdana,sans-serif" moz-do-not-send="true"><span class="gmail-xref gmail-std gmail-std-term" style="box-sizing:border-box">BB_PRESSURE_MAX_MEMORY</span></a><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px"><br style="box-sizing:border-box">
            <br style="box-sizing:border-box">
            I see the range for these variables is from 1 to&nbsp;</font><span style="box-sizing:border-box;color:rgb(51,51,51);font-size:16px;font-family:Verdana,sans-serif;background-color:rgb(252,252,252)">1000000,
            so I would like to understand if there is a way to specify
            their values as a function of the available&nbsp;RAM.</span><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px"><br style="box-sizing:border-box">
          </font></div>
      </div>
    </blockquote>
    <font face="Work Sans, sans-serif" color="#232e3c">No, there is only
      pressure when resources are over-commited so if you have free
      memory, there's no over-commit.<br>
      &nbsp; &nbsp;<a class="moz-txt-link-freetext" href="https://docs.kernel.org/accounting/psi.html">https://docs.kernel.org/accounting/psi.html</a><br>
      <br>
      That's the design intent of the bitbake PRESSURE regulation
      system.<br>
      <br>
      There are plans to work on additional build system regulation.<br>
      <br>
      The first idea is to use the jobserver design:<br>
      &nbsp;
&nbsp;<a class="moz-txt-link-freetext" href="https://lore.kernel.org/openembedded-core/?q=GNU+AND+jobserver++AND+f%3Amacleod">https://lore.kernel.org/openembedded-core/?q=GNU+AND+jobserver++AND+f%3Amacleod</a><br>
      and that would indirectly limit memory consumption since there
      would be fewer instances of gcc / rustc / ... running<br>
      at once.<br>
      <br>
      There's also an even less clear idea about being able to restrict
      the build by specifying memory usage.<br>
      That shouldn't be too hard to implement in bitbake in the same
      point where the pressure checks happen.<br>
      Are you interested in working on that ?<br>
      <br>
      There are of course other levers to pull to reduce CPU/memory
      consumption:<br>
      &nbsp; <a class="moz-txt-link-freetext" href="https://docs.yoctoproject.org/dev-manual/limiting-resources.html">https://docs.yoctoproject.org/dev-manual/limiting-resources.html</a><br>
      <br>
      Have you tried them ?<br>
      <br>
      <br>
    </font>
    <blockquote type="cite" cite="mid:CAPGGCfrQqFjk68=6_JXCrj3XyxK1inZUNzjx4JZikm0MfhfQFg@mail.gmail.com">
      <div dir="ltr">
        <div><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px"><br style="box-sizing:border-box">
            Regards,</font></div>
        <div><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px"><br>
          </font></div>
        <div><font color="#232e3c" face="Work Sans, sans-serif" style="box-sizing:border-box;font-size:16px">Luis</font></div>
        <div>
          <div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr"><span>
                <div dir="ltr" style="margin-left:0pt" align="left"><span><br>
                    <br>
                  </span></div>
              </span></div>
          </div>
        </div>
      </div>
      <br>
      <div><a href="https://ridgerun.ai/" target="_blank" moz-do-not-send="true"><img src="https://developer.ridgerun.com/wiki/images/thumb/5/57/RidgeRun.ai_banner.png/800px-RidgeRun.ai_banner.png?20260326200537" alt="File:RidgeRun.ai banner.png" moz-do-not-send="true"></a><span style="color:rgb(0,0,0);font-family:&quot;Work Sans&quot;,sans-serif;font-size:9.33333px;text-align:justify"></span></div>
      <font size="1">This email and any attachments are intended for the
        sole use of the named recipient(s) and contain(s) confidential
        information that may be proprietary, privileged, or copyrighted
        under applicable law. If you are not the intended recipient, do
        not read, copy, or forward this email message or any
        attachments, delete this email message and any attachments
        immediately.</font>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#66637): <a class="moz-txt-link-freetext" href="https://lists.yoctoproject.org/g/yocto/message/66637">https://lists.yoctoproject.org/g/yocto/message/66637</a>
Mute This Topic: <a class="moz-txt-link-freetext" href="https://lists.yoctoproject.org/mt/120213825/3616765">https://lists.yoctoproject.org/mt/120213825/3616765</a>
Group Owner: <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.yoctoproject.org/g/yocto/unsub">https://lists.yoctoproject.org/g/yocto/unsub</a> [<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>]
-=-=-=-=-=-=-=-=-=-=-=-

</pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
# Randy MacLeod
# Wind River Linux</pre>
  </body>
</html>

--------------zXbtEdKpYmWZuypEyXgR6OnQ--