# How to set Hugo\_memorylimit

**URL:** <https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663>\
**Category:** support\
**Created:** [September 24, 2024, 2:37pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663 "2024-09-24T14:37:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![karis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/karis/32/22946_2.png) [@karis](https://discourse.gohugo.io/u/karis)\
**Post date:** [September 24, 2024, 2:37pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/1 "2024-09-24T14:37:54Z")

</div>

How is this supposed to be set? I have `HUGO_MEMORYLIMIT = 2` in hugo.toml, but a project pulling remote data into pages is taking close to 5-6GB of RAM freezing my laptop.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 24, 2024, 4:38pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/2 "2024-09-24T16:38:56Z")

</div>

> [@karis](#):
>
> I have `HUGO_MEMORYLIMIT = 2` in hugo.toml

HUGO\_MEMORYLIMIT is an operating system environment variable. It is not a key that you would use in your site configuration. See:  
[https://gohugo.io/getting-started/configuration/#configuration-environment-variables](https://gohugo.io/getting-started/configuration/#configuration-environment-variables)

An environment variable can be permanent, or you can set it via the command line before you run the executable.

---

<div class="post-metadata">

**Author:** ![karis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/karis/32/22946_2.png) [@karis](https://discourse.gohugo.io/u/karis)\
**Post date:** [September 24, 2024, 6:14pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/3 "2024-09-24T18:14:27Z")

</div>

> [@jmooring](#):
>
> An environment variable can be permanent

Does hugo recognize `env` files? ChatGPT says it doesn’t out of the box.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 24, 2024, 6:17pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/4 "2024-09-24T18:17:02Z")

</div>

Yes, Hugo recognizes environment variables. That’s why we have two sections about them in the documentation.

Perhaps ChatGPT is referring to Hugo’s security policy which defines an allow list:  
[https://gohugo.io/about/security/#security-policy](https://gohugo.io/about/security/#security-policy)

---

<div class="post-metadata">

**Author:** ![karis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/karis/32/22946_2.png) [@karis](https://discourse.gohugo.io/u/karis)\
**Post date:** [September 24, 2024, 6:24pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/5 "2024-09-24T18:24:01Z")

</div>

> [@jmooring](#):
>
> operating system environment variable

I created one to run via bash. If there is a better way, please let me know.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 24, 2024, 6:25pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/6 "2024-09-24T18:25:02Z")

</div>

Depends on OS, but with Ubuntu you can define them in your .profile or .bashrc file.

---

<div class="post-metadata">

**Author:** ![karis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/karis/32/22946_2.png) [@karis](https://discourse.gohugo.io/u/karis)\
**Post date:** [September 24, 2024, 7:00pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/7 "2024-09-24T19:00:44Z")

</div>

I am on Linux Mint (for a few weeks now). `.bashsrc` works!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [September 26, 2024, 7:01pm UTC](https://discourse.gohugo.io/t/how-to-set-hugo-memorylimit/51663/8 "2024-09-26T19:01:28Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
