Of course as well as limiting the total amount of memory a running program is allowed to allocate, we can also limit how many CPU instructions it can execute and numerous other (OS dependent) resource uses. Accounting for this all operations are fallible, which no practical language copes with.
It's very normal in a Unix to be allowed to limit total runtime for example.
It's very normal in a Unix to be allowed to limit total runtime for example.