# Script is running out of memory

**URL:** <https://dragonfly.discourse.group/t/script-is-running-out-of-memory/217>\
**Category:** Dragonfly Technical\
**Created:** [October 3, 2024, 5:08pm UTC](https://dragonfly.discourse.group/t/script-is-running-out-of-memory/217 "2024-10-03T17:08:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![intj9839](https://avatars.discourse-cdn.com/v4/letter/i/ed655f/32.png) [@intj9839](https://dragonfly.discourse.group/u/intj9839)\
**Post date:** [October 3, 2024, 5:08pm UTC](https://dragonfly.discourse.group/t/script-is-running-out-of-memory/217/1 "2024-10-03T17:08:56Z")

</div>

Hi, we have a script that’s been running out of memory, and was wondering if Dragonfly DB has any options to modify how much memory a script is allowed to use:

 ![image](https://canada1.discourse-cdn.com/flex004/uploads/dragonfly/original/1X/7cf196c70ced69fe1d1ad03c445e9ae3379a0075.png)

We didn’t run into this in our staging environment but running into this issue at the moment in production - so if anyone can shed a light it would be very much appreciated 🙏

edit: we are using close to maxmemory on that dragonfly db recently actually (21Gb / 24Gb)

Thank you

---

<div class="post-metadata">

**Author:** ![dranikpg](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/dranikpg/32/68_2.png) [@dranikpg](https://dragonfly.discourse.group/u/dranikpg)\
**Post date:** [October 7, 2024, 5:13pm UTC](https://dragonfly.discourse.group/t/script-is-running-out-of-memory/217/2 "2024-10-07T17:13:03Z")

</div>

Hi! As far as I know, we don’t limit a scripts memory, only it’s stack depth, so your’re running out memory in general because of your script 🙂 I saw you asking about SCRIPT GC - you can try running it manually from time to time to force lua to free any unsused objects after a script invocation. Otherwise, try either using more memory or updating the script to create less heavy objects/collections

---

<div class="post-metadata">

**Author:** ![joezhou\_df](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/joezhou_df/32/82_2.png) [@joezhou\_df](https://dragonfly.discourse.group/u/joezhou_df)\
**Post date:** [October 7, 2024, 5:26pm UTC](https://dragonfly.discourse.group/t/script-is-running-out-of-memory/217/3 "2024-10-07T17:26:47Z")

</div>

Thank you so much for chiming in! @dranikpg

@intj9839 If you need further community help, generally we need to ask about your hardware setups, workloads, actual scripts/commands you are using, etc. Basically, a way or an environment we can easily reproduce your issue—it would be much easier that way.
