Basically, I want to run compiled C ++ code and limit the execution time (for example, to the second) and memory (up to 100 thousand), like online judges. Can I add parameters to the command? This must be done without changing the source code.
Try to run the command ulimit, it can set limits on the time and memory of the processor.
ulimit
Try this example.
bash -c 'ulimit -St 1 ; while true; do true; done;'
The result you get will be
CPU time limit exceeded (core dumped)
To limit time, you can use the "timeout" command
timeout 15s command
Check it out for more details: link
Source: https://habr.com/ru/post/1624426/More articles:VSTS Create New WorkItem - vstsDynamic path segment OR 404 - react-routerFatal error: Unacceptable error: call select () member function at zero - oopВызов метода undefined SocialiteProviders\Manager\ServiceProvider:: driver() - phpREST: How to get a list of rows of a selected sheet in Smartsheet - restHow a PHP application can retrieve huge data through MySQL, which exceeds the value max_allowed_packet - phpGet predicate runtime in seconds - prologПочему assembleDebug занимает намного больше времени, чем сборка проекта и как его оптимизировать? - androidBoto получить местоположение корзины s3 - pythonRedux / React and MVC, OOP - javascriptAll Articles