plus you'd lose the ability to compute ackerman's function, which i'm doing all the time
On Wed, May 29, 2019 at 7:35 AM adonovan via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Tuesday, 21 May 2019 01:18:34 UTC-4, Ben Hoyt wrote: >> >> I'm looking at adding a timeout option to my GoAWK script interpreter... >> Are there better / more performant ways to handle this? >> > > > Hi Ben, imposing resource bounds is a tricky problem. It's possible to do > it in an interpreter implemented in C++, but it requires careful discipline > throughout the implementation. It is essentially impossible to do in a > target language whose variables are recycled by the garbage collector of > the host language. Turing incompleteness of the target language (bounded > recursion only) seems like it ought to help but in fact does not; a bounded > program can still use all your memory and take ~forever. > > The only reliable way to impose bounds is to use the operating system. Put > the untrusted code in a different process, impose a limit on its maximum > memory size, and kill it if it hasn't finished by your deadline. > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/b4182f6d-8a3c-41a2-9cb0-e9d3c7fb1780%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/b4182f6d-8a3c-41a2-9cb0-e9d3c7fb1780%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2BYjuxuCGVtH3xBt6u4QZQc2YYOvU4d90bqRXdyxjYSoiF%3DttA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.