Thread overview | |||||
---|---|---|---|---|---|
|
February 27, 2016 [dmd-internals] Unterminated loops in ctfe | ||||
---|---|---|---|---|
| ||||
Currently, when a function which has an infinite loop gets run at compile-time, dmd keeps acquiring more and more resources, eventually leading to X11 (I uss Linux) freezing and me having to force-close it and then restart it.
A solution to this problem is needed. It's simply ridiculous that I have to restart X11 anytime I make such a mistake. Perhaps something like a limit to the number of iterations needs to be implemented?
Example of unterminated loop in ctfe:
int func() {
while(true) {}
return 2;
}
template t() {
enum int i = func;
}
Thoughts?
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals
|
February 28, 2016 Re: [dmd-internals] Unterminated loops in ctfe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lass Safin | Your OS should be protecting you from this. You could try manually setting a memory limit on dmd: http://unix.stackexchange.com/questions/44985/limit-memory-usage-for-a-single-linux-process On Sun, Feb 28, 2016 at 6:08 AM, Lass Safin via dmd-internals <dmd-internals@puremagic.com> wrote: > Currently, when a function which has an infinite loop gets run at compile-time, dmd keeps acquiring more and more resources, eventually leading to X11 (I uss Linux) freezing and me having to force-close it and then restart it. > > A solution to this problem is needed. It's simply ridiculous that I have to restart X11 anytime I make such a mistake. Perhaps something like a limit to the number of iterations needs to be implemented? > > Example of unterminated loop in ctfe: > int func() { > while(true) {} > return 2; > } > > template t() { > enum int i = func; > } > > Thoughts? > _______________________________________________ > dmd-internals mailing list > dmd-internals@puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-internals _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
March 15, 2016 Re: [dmd-internals] Unterminated loops in ctfe | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lass Safin Attachments:
| On 02/27/2016 08:08 PM, Lass Safin via dmd-internals wrote: > A solution to this problem is needed. It's simply ridiculous that I have to restart X11 anytime I make such a mistake. Perhaps something like a limit to the number of iterations needs to be implemented? There is no solution to the [Halting problem](https://en.wikipedia.org/wiki/Halting_problem) and any heuristic will need some extra knobs for certain use-cases. While we want to address the amount of memory used by the CTFE interpreter, it's much easier if you kill the compiler yourself, rather than having us implement some arbitrary limitation. killall dmd |
Copyright © 1999-2021 by the D Language Foundation