in reply to Re^4: safe untrusted regexp
in thread safe untrusted regexp

Not all of the memory on the machine, all of the C stack. It's a fixed-size piece of memory reserved for the the storage of the parameters and the local variables of C functions. Perl's guts and functions called via XS make use of this stack.

See the thread What perl operations will consume C stack space? and particularly hv's reply.