Skip to content

How is RAM and Heap Space allocated for a linux/unix command?

So when I execute a linux command, say a cat command for this example, on a server with 128 GB of RAM, assuming none of this RAM is currently in use, all is free. (I realize this will never happen, but that’s why it’s an example)

1) Would this command then be executed with a heap space of all 128 GB? Or would it be up to the linux distro I am using to decide how much heap space is aloocated from the available 128 GB?

2) If so, is there another command line argument that I can pass along with my cat command to reserve more heap space than the system standard?

EDIT: 3) Is there a way which I can identify how much heap space will be allocated for my cat command (or any command), preferrably a built-in command line solution, not an external application. If it’s not possible please say so, I am just curious.



When you start a program, some amount of memory is allocated for the program; however, this amount of memory is not the limit to what the program is allowed to use. Whenever more memory is requested, it can be granted up until the system has used up all of the memory.

User contributions licensed under: CC BY-SA
9 People found this is helpful