So I have 4 GB RAM + 4GB swap. I want to create a user with limited ram and swap: 3 GB RAM and 1 GB swap. Is such thing possible? Is it possible to start applications with limited RAM and swap avaliable to them without creating a separate user (and not installing any special apps - having just a default Debian/CentOS server configuration, and not using sudo)?
Update:
So I opened terminall and typed into it ulimit command: ulimit -v 1000000 which shall be like 976,6Mb limitation. Next I called ulimit -a and saw that limitation is "on". Then I started some bash script that compiles and starts my app in nohup, a long one nohup ./cloud-updater-linux.sh >& /dev/null &... but after some time I saw:

(which would be ok if no limitations were applied - it downloaded some large lib, and started to compile it.)
But I thought I applied limitations to the shell and all processes launched with/from it with ulimit -v 1000000? What gotdid I get wrong? How to make a terminal and all sub processes it launches be limited on ram usage?