Puppet-agent out of memory

Problem:
Hi. When trying to synchronize a 150MB file via puppet, puppet stops the operation with the message “killed”. If you look at strace, it becomes clear that the process was killed due to the fact that all RAM (8Gb) ran out. Please tell me how you can reduce the amount of memory consumed by the puppet-agent?
Expected outcome:
synchronization ended without errors
Foreman and Proxy versions:
Foreman 3.4.1
Proxy 3.4.1
Foreman and Proxy plugin versions:
Foreman 3.4.1
puppet-plugin 4.1.1
Distribution and version:

Other relevant data:

Not sure if you are aware of the puppet type file can now handle http as a source. Not sure if this could solve your problem but made the file handling in many cases easier and better performing for me.

Is that what you mean?

class test {
file {
 '/opt/scripts/test':
  ensure  => file,
  mode => '0777',
  owner => 'root',
  group => 'root',
  content => file("/etc/puppetlabs/code/environments/test/files/test"),
}
}


No, the file type as two ways to manage the content.
One attribute is content which allows to manage simple strings or by using the function template to use embedded ruby for dynamic files or epp for embedded puppet code to do so.
The other attribute is source which allows to transfer files. The source can be a puppet url transfering from the puppet server with its own protocol, a local file with just a path definition or a file url, or a http url allowing to download the file from a web server which is better suited to handle big files and could be better scaled if needed.

https://www.puppet.com/docs/puppet/latest/types/file.html#file-attribute-source