I want to create a dummy workflow for testing a workflow managing software.
Is there a python function where I can say how much RAM it must use? So I can make multiple workflows, all needing a different amount of RAM.
Else, do you know good dummy workflows I can use?
Simply create any primitive type of desired size:
>>> import sys
>>> sys.getsizeof(bytes(1024 * 1024))
1048609
Note that by the nature of how Python works, no method will exactly set the memory consumption. The overhead should be roughly constant and negligible for all significant sizes, though.
A modified version of code from here: https://askubuntu.com/a/301063/1102943
Code (python3):
import numpy
def take_up_ram(gigabytes):
n = gigabytes * 1024
result = [numpy.random.bytes(1024*1024) for x in range(n)]
print(len(result))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With