# Memory consumption when working with large input args

**URL:** <https://forum.ansible.com/t/memory-consumption-when-working-with-large-input-args/37590>\
**Category:** Ansible Developer\
**Created:** [January 30, 2023, 12:45pm UTC](https://forum.ansible.com/t/memory-consumption-when-working-with-large-input-args/37590 "2023-01-30T12:45:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paco\_Ramon\_Penella](https://avatars.discourse-cdn.com/v4/letter/p/b5e925/32.png) [@Paco\_Ramon\_Penella](https://forum.ansible.com/u/Paco_Ramon_Penella)\
**Post date:** [January 30, 2023, 12:45pm UTC](https://forum.ansible.com/t/memory-consumption-when-working-with-large-input-args/37590/1 "2023-01-30T12:45:01Z")

</div>

Hi all,

I realized that when working with large input arguments in a task, this causes problems of high memory consumption. Let me give you more details.

I developed a custom module, called get\_artifacts, which receives as an input argument (among others), a list of artifacts to be downloaded in each host.  
This list of artifacts is list of json objects containing a lot of properties for each artifact (like size, url, permissions, path, etc.) which means it can weigh around 60MB.

When I execute my playbook, I have noticed that memory is increased every time that a host finish the custom task.

Detailed examples:

- My set up:

> > ansible --version  
> > ansible [core 2.11.12]  
> > config file = memory\_consumption/ansible/ansible.cfg  
> > configured module search path = [u’memory\_consumption/ansible/role\_deploy/library’]  
> > ansible python module location = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible  
> > ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections  
> > executable location = /Library/Frameworks/Python.framework/Versions/2.7/bin/ansible  
> > python version = 2.7.16 (v2.7.16:413a49145e, Mar 2 2019, 14:32:10) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]  
> > jinja version = 2.10.1  
> > libyaml = False

> > cat ansible.cfg  
> > [defaults]  
> > library = ./role\_deploy/library  
> > module\_utils = ./role\_deploy/library/module\_utils  
> > callback\_whitelist = profile\_memory  
> > forks = 1

- When the task starts:

TASK [role\_deploy : Download the artifacts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

----------\>[started task TASK: role\_deploy : Download the artifacts]

Filename: memory\_consumption/ansible/role\_deploy/callback\_plugins/profile\_memory.py

Line # Mem usage Increment Line Contents
