Thread overview | |||||
---|---|---|---|---|---|
|
November 12, 2003 Deep recursion problem | ||||
---|---|---|---|---|
| ||||
When doing some testing with my ddepcheck app, I found out that to deep recursion isn't handled perfectly by D/dmd. If the recursion is infinite, it crashes very quickly. If I try to limit it, I get an Acces Violation at a certain depth (18 with an optimized build, deeper when not optimized). The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) Lars Ivar Igesund |
November 12, 2003 Re: Deep recursion problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | D shouldn't have any different recursion issues than C or C++. "Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message news:bost27$1mcg$1@digitaldaemon.com... > When doing some testing with my ddepcheck app, I found > out that to deep recursion isn't handled perfectly by D/dmd. If > the recursion is infinite, it crashes very quickly. If I try to limit > it, I get an Acces Violation at a certain depth (18 with an > optimized build, deeper when not optimized). > > The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. > > (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) > > Lars Ivar Igesund > > |
November 13, 2003 Re: Deep recursion problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | I just compiled and ran the following code, and it descended to a depth of 51728 before reporting "Error: Access Violation" import std.c.stdio; void fn(int i) { printf("%d\n", i); fn(1 + i); } int main() { fn(0); return 0; } Hope that helps "Lars Ivar Igesund" <larsivi@stud.ntnu.no> wrote in message news:bost27$1mcg$1@digitaldaemon.com... > When doing some testing with my ddepcheck app, I found > out that to deep recursion isn't handled perfectly by D/dmd. If > the recursion is infinite, it crashes very quickly. If I try to limit > it, I get an Acces Violation at a certain depth (18 with an > optimized build, deeper when not optimized). > > The quick crash result in no message whatsoever, but I would have expected an Out of Memory error. The access violation don't say anything about what is violated or where. Better diagnostic messages would have been helpful. > > (The problems helped me make a more robust recursive app, btw. The recursion can no longer be infinite.) > > Lars Ivar Igesund > > |
Copyright © 1999-2021 by the D Language Foundation