Yes, if that much is needed, except for memory used by the host OS/kernel and other processes running on same machine.
There is no overall limit or option for the build, but specific build tools may have limits and options.
Generally it is not necessary to configure these.
The host OS may have facilities for limits ...
for example Linux has cgroups, and bash has the ulimit command.
But you will usually not need to use these.